diff options
author | RaindropsSys <raindrops@equestria.dev> | 2024-05-10 19:42:49 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2024-05-10 19:42:49 +0200 |
commit | 0d2c955098f7a16e1b844196fb6f996c5e09d9c8 (patch) | |
tree | b53ab4317cc9e219acce0e28432c6c3322a10b44 | |
parent | a0b8badf429a559f2de7176fba8184e436bd9ff4 (diff) | |
download | atomic-0d2c955098f7a16e1b844196fb6f996c5e09d9c8.tar.gz atomic-0d2c955098f7a16e1b844196fb6f996c5e09d9c8.tar.bz2 atomic-0d2c955098f7a16e1b844196fb6f996c5e09d9c8.zip |
Crappy code fix 1/?
-rw-r--r-- | launcher/.idea/vcs.xml | 1 | ||||
-rw-r--r-- | launcher/src/main.rs | 23 |
2 files changed, 13 insertions, 11 deletions
diff --git a/launcher/.idea/vcs.xml b/launcher/.idea/vcs.xml index 35eb1dd..62bd7a0 100644 --- a/launcher/.idea/vcs.xml +++ b/launcher/.idea/vcs.xml @@ -2,5 +2,6 @@ <project version="4"> <component name="VcsDirectoryMappings"> <mapping directory="" vcs="Git" /> + <mapping directory="$PROJECT_DIR$/.." vcs="Git" /> </component> </project>
\ No newline at end of file diff --git a/launcher/src/main.rs b/launcher/src/main.rs index 6f3e21c..28813f6 100644 --- a/launcher/src/main.rs +++ b/launcher/src/main.rs @@ -4,29 +4,30 @@ use std::process::{Command, exit}; use dirs::home_dir; use rustc_version_runtime::version; -fn get_home() -> String { - let home_buf = home_dir() - .unwrap_or(PathBuf::from("/")); - let os_string = home_buf - .into_os_string(); - os_string - .to_string_lossy() - .to_string() +fn get_home() -> PathBuf { + home_dir() + .unwrap_or(PathBuf::from("/")) } #[cfg(target_os = "macos")] fn get_home_search() -> PathBuf { - PathBuf::from(format!("{}/Library/Frameworks/AtomicRuntime.framework", get_home())) + PathBuf::from(format!("{}/Library/Frameworks/AtomicRuntime.framework", get_home() + .to_str() + .unwrap_or("/"))) } #[cfg(target_os = "linux")] fn get_home_search() -> PathBuf { - PathBuf::from(format!("{}/.local/share/atomic-runtime", get_home())) + PathBuf::from(format!("{}/.local/share/atomic-runtime", get_home() + .to_str() + .unwrap_or("/"))) } #[cfg(target_os = "windows")] fn get_home_search() -> PathBuf { - PathBuf::from(format!("{}\\AppData\\Local\\Atomic Runtime", get_home())) + PathBuf::from(format!("{}\\AppData\\Local\\Atomic Runtime", get_home() + .to_str() + .unwrap_or("/"))) } #[cfg(target_os = "macos")] |