aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
Diffstat (limited to 'launcher')
-rw-r--r--launcher/src/main.rs19
1 files changed, 9 insertions, 10 deletions
diff --git a/launcher/src/main.rs b/launcher/src/main.rs
index 0afb8aa..3a961a0 100644
--- a/launcher/src/main.rs
+++ b/launcher/src/main.rs
@@ -112,19 +112,18 @@ fn main() {
show_system_info();
println!("atomic-launcher: Compiled against rustc {}", rustc_version_runtime::version());
- let my_path_buf = std::env::current_exe()
- .unwrap_or(PathBuf::from("/"));
- let my_path = my_path_buf
- .parent()
- .unwrap_or(Path::new("/"))
- .to_str()
- .unwrap_or("/");
+ let exec_path = std::env::current_exe();
+ let work_dir = exec_path.as_ref().map(|p| p.parent()).ok()
+ .unwrap_or(Some(Path::new("/")))
+ .unwrap_or(Path::new("/"));
- println!("atomic-launcher: Current directory: {}", my_path);
+ println!("atomic-launcher: Current directory: {}", work_dir
+ .to_str()
+ .unwrap_or("/"));
let mut found_app = false;
- let app_path_unparsed = &format!("{}/{}", my_path, APP_DATA_PATH);
- let app_path = Path::new(app_path_unparsed);
+ let mut app_path = PathBuf::from(work_dir);
+ app_path.push(APP_DATA_PATH);
if app_path.exists() {
found_app = true;