From 2dcbcd0949d9a47a0a900040af62d3b2df53a15b Mon Sep 17 00:00:00 2001 From: bruno Date: Mon, 27 Jul 2026 01:12:27 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20desktop=20=E2=80=94=20use=20HOME=20inste?= =?UTF-8?q?ad=20of=20USERPROFILE=20on=20Linux=20for=20default=20vault=20pa?= =?UTF-8?q?th?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop/src/main.rs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/desktop/src/main.rs b/desktop/src/main.rs index 0618d53..87f1677 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -443,12 +443,15 @@ fn main() { // Load config for window state let mut config = load_config(); - // First run: create default vault config + // First run: create sensible defaults per platform if config.vaults.is_empty() { info!("First run — creating default vault configuration"); - let userprofile = std::env::var("USERPROFILE").unwrap_or_else(|_| "C:\\Users\\Default".to_string()); - let vault_dir = std::path::PathBuf::from(&userprofile).join("voute_obsidian"); + #[cfg(target_os = "windows")] + let home = std::env::var("USERPROFILE").unwrap_or_else(|_| "C:\\Users\\Default".to_string()); + #[cfg(not(target_os = "windows"))] + let home = std::env::var("HOME").unwrap_or_else(|_| "/home/bruno".to_string()); + let vault_dir = std::path::PathBuf::from(&home).join("voute_obsidian"); // Create the vault directory if it doesn't exist if !vault_dir.exists() { if let Err(e) = fs::create_dir_all(&vault_dir) { @@ -457,12 +460,8 @@ fn main() { info!("Created default vault dir: {}", vault_dir.display()); } } - config.dirs = vec![ - DirConfig { - name: "Bruno".to_string(), - path: userprofile.clone(), - }, + DirConfig { name: "bruno".to_string(), path: home.clone() }, ]; config.vaults = vec![ VaultConfig { @@ -470,7 +469,7 @@ fn main() { path: vault_dir.to_string_lossy().to_string(), }, ]; - config.vault_path = Some(userprofile); + config.vault_path = Some(home); save_config(&config); info!("Default vault config saved"); }