style: file canonicalize
This commit is contained in:
11
src/main.rs
11
src/main.rs
@@ -67,12 +67,11 @@ runrs <script.rs> [arguments]
|
||||
let mut run_script_cmd = if cache_script_bin_name_exists {
|
||||
Command::new(cache_script_bin_name)
|
||||
} else {
|
||||
if let Ok(canonicalized_script_file) = PathBuf::from(script_file).canonicalize() {
|
||||
if let Some(canonicalized_script_file) = canonicalized_script_file.to_str() {
|
||||
let cache_script_bin_name_src = format!("{}.src", cache_script_bin_name);
|
||||
if let Ok(_) = fs::write(&cache_script_bin_name_src, &format!("{}\n", canonicalized_script_file)) {
|
||||
debugging!("Add {} to {}", canonicalized_script_file, cache_script_bin_name_src);
|
||||
}
|
||||
if let Ok(Some(canonicalized_script_file)) = PathBuf::from(script_file)
|
||||
/* - */.canonicalize().map(|f| f.to_str().map(|f| f.to_string())) {
|
||||
let cache_script_bin_name_src = format!("{}.src", cache_script_bin_name);
|
||||
if let Ok(_) = fs::write(&cache_script_bin_name_src, &format!("{}\n", canonicalized_script_file)) {
|
||||
debugging!("Add {} to {}", canonicalized_script_file, cache_script_bin_name_src);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user