tiny refactoring
tiny refactoring
This commit is contained in:
parent
b91b30b1e0
commit
b4672e4057
@ -8,18 +8,12 @@ use std::path::PathBuf;
|
||||
///
|
||||
/// Return executable path or . if can't determine it
|
||||
pub fn get_exe_path() -> String {
|
||||
let mut dir;
|
||||
let exe_path: String;
|
||||
|
||||
match env::current_exe() {
|
||||
Ok(full_name) => {
|
||||
dir = PathBuf::from(full_name);
|
||||
let mut dir = PathBuf::from(full_name);
|
||||
dir.pop();
|
||||
exe_path = dir.clone().into_os_string().into_string().unwrap();
|
||||
},
|
||||
Err(_e) => {
|
||||
exe_path = ".".to_string();
|
||||
dir.into_os_string().into_string().unwrap_or(".".to_string())
|
||||
},
|
||||
Err(_) => ".".to_string(),
|
||||
}
|
||||
return exe_path;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user