Remove absolute path for files in the current directory.

This commit is contained in:
Stephen Chung 2021-07-14 18:32:22 +08:00
parent 7c93622b57
commit e3668227c0
2 changed files with 11 additions and 2 deletions

View File

@ -78,7 +78,12 @@ fn main() {
eprintln!("Error script file path: {}\n{}", filename, err);
exit(1);
}
Ok(f) => f,
Ok(f) => {
match f.strip_prefix(std::env::current_dir().unwrap().canonicalize().unwrap()) {
Ok(f) => f.into(),
_ => f,
}
}
};
contents.clear();

View File

@ -43,7 +43,11 @@ fn main() {
eprintln!("Error script file path: {}\n{}", filename, err);
exit(1);
}
Ok(f) => f,
Ok(f) => match f.strip_prefix(std::env::current_dir().unwrap().canonicalize().unwrap())
{
Ok(f) => f.into(),
_ => f,
},
};
let mut engine = Engine::new();