fix: desktop — use HOME instead of USERPROFILE on Linux for default vault path
CI / lint (push) Successful in 27s
CI / security (push) Successful in 17s
CI / test (push) Successful in 32s
CI / build (push) Successful in 8s
CI / e2e (push) Failing after 31s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
CI / lint (push) Successful in 27s
CI / security (push) Successful in 17s
CI / test (push) Successful in 32s
CI / build (push) Successful in 8s
CI / e2e (push) Failing after 31s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
This commit is contained in:
+8
-9
@@ -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");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user