Change naming convention for folders to append index after the name

This commit is contained in:
raj921 2024-10-15 21:26:08 +05:30
parent 097e5abb82
commit 3179257068

View file

@ -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);
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(i.to_string());
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);
i += 1;