From 0d2c955098f7a16e1b844196fb6f996c5e09d9c8 Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Fri, 10 May 2024 19:42:49 +0200 Subject: Crappy code fix 1/? --- launcher/src/main.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'launcher/src/main.rs') 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")] -- cgit