diff --git a/src/common/system.rs b/src/common/system.rs index f7c4036..d9a8261 100644 --- a/src/common/system.rs +++ b/src/common/system.rs @@ -22,6 +22,7 @@ impl SystemPaths { .expect("failed to execute process") } + #[cfg(target_os = "windows")] pub fn home_dir() -> String { let output = SystemPaths::user_home_dir(); @@ -30,6 +31,15 @@ impl SystemPaths { home.to_string().replace("\\\\", "\\") } + #[cfg(target_os = "linux")] + pub fn home_dir() -> String { + let output = SystemPaths::user_home_dir(); + + let home = strip_trailing_newline(str::from_utf8(&output.stdout).unwrap()); + + format!("/{}", home.to_string().replace("\\\\", "\\")) + } + #[cfg(target_os = "windows")] pub fn vscode_workspace_storage_path() -> String { let home = SystemPaths::home_dir();