From 31792570680ac6afa3fd755cbed677955923a9f1 Mon Sep 17 00:00:00 2001 From: raj921 Date: Tue, 15 Oct 2024 21:26:08 +0530 Subject: [PATCH] Change naming convention for folders to append index after the name --- yazi-shared/src/fs/path.rs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/yazi-shared/src/fs/path.rs b/yazi-shared/src/fs/path.rs index 592e4f17..dd8343e0 100644 --- a/yazi-shared/src/fs/path.rs +++ b/yazi-shared/src/fs/path.rs @@ -100,9 +100,19 @@ pub async fn unique_name(mut u: Url) -> io::Result { let mut name = OsString::with_capacity(stem.len() + ext.len() + 5); name.push(&stem); - name.push("_"); - name.push(i.to_string()); - name.push(&ext); + + // 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;