fix: Cargo.lock tracken, verbose durchreichen, Config-Fehler melden, Platzhalter-Kollision beheben
- Cargo.lock aus .gitignore entfernt (Rust-Konvention: für Binaries committen) - verbose-Parameter in clean_filename() wird jetzt korrekt von args.verbose durchgereicht statt hardcoded false - Config::load() gibt bei Parse-Fehlern eine Warnung aus statt den Fehler still zu schlucken - Platzhalter für C++/C# von CPLUSPLUS/CSHARP zu NTUxCPLUSPLUSx/NTUxCSHARPx geändert um Kollisionen mit echten Dateinamen zu vermeiden Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
de9bb4fd03
commit
bd82fd7b30
5 changed files with 35 additions and 30 deletions
|
|
@ -1,5 +1,5 @@
|
|||
use anyhow::{Context, Result};
|
||||
use log::{debug, info};
|
||||
use log::{debug, info, warn};
|
||||
use serde::Deserialize;
|
||||
use std::collections::HashMap;
|
||||
use std::fs;
|
||||
|
|
@ -41,18 +41,27 @@ impl Config {
|
|||
}
|
||||
}
|
||||
|
||||
/// Öffentliche Methode zum Laden einer Konfiguration aus einem Pfad
|
||||
/// Öffentliche Methode zum Laden einer Konfiguration aus einem Pfad.
|
||||
/// Gibt Standardwerte zurück wenn die Datei nicht existiert,
|
||||
/// propagiert aber Parse-Fehler als Warnung.
|
||||
pub fn load(path: &str, verbose: bool) -> Result<Self> {
|
||||
let cfg_path = Path::new(path);
|
||||
if !cfg_path.exists() {
|
||||
if verbose {
|
||||
info!(
|
||||
"Keine Konfigurationsdatei '{}' gefunden. Verwende Standardwerte.",
|
||||
path
|
||||
);
|
||||
}
|
||||
return Ok(Self::default());
|
||||
}
|
||||
match Self::load_internal(cfg_path, verbose) {
|
||||
Ok(config) => Ok(config),
|
||||
Err(_) => {
|
||||
if verbose {
|
||||
info!(
|
||||
"Keine Konfigurationsdatei '{}' gefunden. Verwende Standardwerte.",
|
||||
path
|
||||
);
|
||||
}
|
||||
Err(e) => {
|
||||
warn!(
|
||||
"Fehler beim Laden der Konfigurationsdatei '{}': {}. Verwende Standardwerte.",
|
||||
path, e
|
||||
);
|
||||
Ok(Self::default())
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue