fix: Versteckte Dateien (.gitignore etc.) werden nicht mehr fälschlicherweise umbenannt
- Bugfix: Dateien mit führendem Punkt wurden zu "unnamed.xxx" umbenannt, da der Punkt fälschlicherweise als Extension-Trenner interpretiert wurde. Jetzt wird der führende Punkt als hidden_prefix separat behandelt. - Alle Clippy-Warnungen behoben (redundanter Import, kollabierbare if-Blöcke, manuelle Range-Checks) - CLAUDE.md für Projekt-Dokumentation hinzugefügt Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
5997aad904
commit
df4421af2f
4 changed files with 162 additions and 32 deletions
28
src/main.rs
28
src/main.rs
|
|
@ -82,13 +82,11 @@ fn main() -> Result<()> {
|
|||
let old_path = entry.path();
|
||||
|
||||
// Ebenentiefe 0 -> überspringen wir als Verzeichnis, außer --modify_root ist gesetzt
|
||||
if entry.depth() == 0 {
|
||||
if entry.file_type().is_dir() && !args.modify_root {
|
||||
if args.verbose {
|
||||
debug!("Skip root directory: {}", old_path.display());
|
||||
}
|
||||
continue;
|
||||
if entry.depth() == 0 && entry.file_type().is_dir() && !args.modify_root {
|
||||
if args.verbose {
|
||||
debug!("Skip root directory: {}", old_path.display());
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Dateiname (oder Verzeichnisname) ermitteln
|
||||
|
|
@ -107,16 +105,14 @@ fn main() -> Result<()> {
|
|||
info!("{} -> {}", old_path.display(), new_path.display());
|
||||
}
|
||||
|
||||
if !args.no_changes {
|
||||
if is_safe_rename(old_path, &new_path, args.force) {
|
||||
fs::rename(old_path, &new_path).with_context(|| {
|
||||
format!(
|
||||
"Fehler beim Umbenennen: {} -> {}",
|
||||
old_path.display(),
|
||||
new_path.display()
|
||||
)
|
||||
})?;
|
||||
}
|
||||
if !args.no_changes && is_safe_rename(old_path, &new_path, args.force) {
|
||||
fs::rename(old_path, &new_path).with_context(|| {
|
||||
format!(
|
||||
"Fehler beim Umbenennen: {} -> {}",
|
||||
old_path.display(),
|
||||
new_path.display()
|
||||
)
|
||||
})?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue