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
### 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:
parent
3179257068
commit
7fc3587a0d
1 changed files with 3 additions and 4 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue