feat: config vaults par défaut au premier lancement
CI / lint (push) Successful in 35s
CI / security (push) Successful in 16s
CI / test (push) Successful in 30s
CI / build (push) Successful in 13s
CI / e2e (push) Failing after 13s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
CI / lint (push) Successful in 35s
CI / security (push) Successful in 16s
CI / test (push) Successful in 30s
CI / build (push) Successful in 13s
CI / e2e (push) Failing after 13s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
- Détecte config.vaults vide → premier lancement - Crée %USERPROFILE%\voute_obsidian\ automatiquement - Ajoute deux vaults: 'Dossier' (%USERPROFILE%) et 'Obsidian' (voute_obsidian) - vault_path = USERPROFILE pour le sélecteur de dossier
This commit is contained in:
+31
-1
@@ -388,7 +388,37 @@ fn main() {
|
||||
info!("Exe dir: {}", exe_dir.display());
|
||||
|
||||
// Load config for window state
|
||||
let config = load_config();
|
||||
let mut config = load_config();
|
||||
|
||||
// First run: create default vault config
|
||||
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");
|
||||
|
||||
// Create the vault directory if it doesn't exist
|
||||
if !vault_dir.exists() {
|
||||
if let Err(e) = fs::create_dir_all(&vault_dir) {
|
||||
error!("Failed to create default vault dir {}: {}", vault_dir.display(), e);
|
||||
} else {
|
||||
info!("Created default vault dir: {}", vault_dir.display());
|
||||
}
|
||||
}
|
||||
|
||||
config.vaults = vec![
|
||||
VaultConfig {
|
||||
name: "Dossier".to_string(),
|
||||
path: userprofile.clone(),
|
||||
},
|
||||
VaultConfig {
|
||||
name: "Obsidian".to_string(),
|
||||
path: vault_dir.to_string_lossy().to_string(),
|
||||
},
|
||||
];
|
||||
config.vault_path = Some(userprofile);
|
||||
save_config(&config);
|
||||
info!("Default vault config saved");
|
||||
}
|
||||
|
||||
// Spawn Python backend
|
||||
let backend = match spawn_backend(&exe_dir) {
|
||||
|
||||
Reference in New Issue
Block a user