Skip to content

Commit

Permalink
Fix Linux builds
Browse files Browse the repository at this point in the history
  • Loading branch information
WilliamVenner committed Dec 30, 2020
1 parent 539c6be commit 00eeb1a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blackhole"
version = "1.2.0"
version = "1.2.1"
authors = ["William Venner <[email protected]>"]
edition = "2018"
repository = "https://github.com/WilliamVenner/blackhole"
Expand Down
19 changes: 8 additions & 11 deletions src/linux.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 00eeb1a

Please sign in to comment.