diff --git a/Cargo.toml b/Cargo.toml index 788b51a..bcd70aa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "blackhole" -version = "1.2.0" +version = "1.2.1" authors = ["William Venner "] edition = "2018" repository = "https://github.com/WilliamVenner/blackhole" diff --git a/src/linux.rs b/src/linux.rs index 67487bb..3078510 100644 --- a/src/linux.rs +++ b/src/linux.rs @@ -12,34 +12,31 @@ impl Linux for Blackhole { fn copy_executable() { // Locate the executable folder and symlink us there let mut new_exe_path = match dirs::executable_dir() { - Ok(new_exe_path) => new_exe_path, - Err(error) => { - Show::panic("Error getting executable directory: {}", error); - return; - } + Some(new_exe_path) => new_exe_path, + None => return }; new_exe_path.push("blackhole"); - let exe_path = match std::env::current_exe() { + let exe_path = match env::current_exe() { Ok(exe_path) => exe_path, Err(error) => { - Show::panic("Error getting executable path: {}", error); + Show::panic(&format!("Error getting executable path: {}", error)); return; } }; if exe_path == new_exe_path { return } - match fs::rename() { - Ok(_) => return, + match fs::rename(&exe_path, &new_exe_path) { + Ok(_) => (), Err(error) => { - Show::panic("Error moving executable to executables path: {}", error); + Show::panic(&format!("Error moving executable to executables path: {}", error)); return; } } - Show::msg("Blackhole executable has been moved to {}", new_exe_path); + Show::msg(&format!("Blackhole executable has been moved to {}", new_exe_path.display())); } fn chores(&self) {