mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Change naming convention for folders to append index after the name
This commit is contained in:
parent
097e5abb82
commit
3179257068
1 changed files with 13 additions and 3 deletions
|
|
@ -100,9 +100,19 @@ pub async fn unique_name(mut u: Url) -> io::Result<Url> {
|
||||||
|
|
||||||
let mut name = OsString::with_capacity(stem.len() + ext.len() + 5);
|
let mut name = OsString::with_capacity(stem.len() + ext.len() + 5);
|
||||||
name.push(&stem);
|
name.push(&stem);
|
||||||
|
|
||||||
|
// Check if it's a directory
|
||||||
|
if p.is_dir() {
|
||||||
|
// For directories, append the index at the end
|
||||||
name.push("_");
|
name.push("_");
|
||||||
name.push(i.to_string());
|
name.push(i.to_string());
|
||||||
name.push(&ext);
|
name.push(&ext);
|
||||||
|
} else {
|
||||||
|
// For files, keep the existing behavior
|
||||||
|
name.push("_");
|
||||||
|
name.push(i.to_string());
|
||||||
|
name.push(&ext);
|
||||||
|
}
|
||||||
|
|
||||||
p.set_file_name(name);
|
p.set_file_name(name);
|
||||||
i += 1;
|
i += 1;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue