Change naming convention for folders to append index after the name

### Summary
This pull request modifies the `unique_name` function in the `path.rs` file to change the naming convention for folders. Instead of inserting an index before the last dot in the folder name, the index is now appended at the end of the folder name. This change aims to improve the clarity and usability of folder names when duplicates are created.

### Changes Made
- Updated the logic in the `unique_name` function to check if the path is a directory.
- For directories, the index is now appended at the end of the name (e.g., `a.b.c` becomes `a.b.c_1`).
- Maintained the existing behavior for file names.

### Testing
- The changes have been tested to ensure that both file and folder naming conventions work as expected.
This commit is contained in:
raj kumar 2024-10-15 22:04:27 +05:30 committed by GitHub
parent 3179257068
commit 7fc3587a0d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -101,14 +101,13 @@ 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
} else
name.push("_");
name.push(i.to_string());
name.push(&ext);