diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-05-10 20:49:55 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-05-10 20:49:55 +0200 |
commit | bb207c5e012a5a74a0a7ab829b56f34dc9486366 (patch) | |
tree | 5b80e8b99cf7a96884f14f35eb99117c5ff714c0 | |
parent | dd0a8c4ce4f143f193a3165ccf6ef67452581988 (diff) | |
download | atomic-bb207c5e012a5a74a0a7ab829b56f34dc9486366.tar.gz atomic-bb207c5e012a5a74a0a7ab829b56f34dc9486366.tar.bz2 atomic-bb207c5e012a5a74a0a7ab829b56f34dc9486366.zip |
Crappy code fix 5/?
-rw-r--r-- | launcher/src/main.rs | 19 |
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; |