summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Shulgin <izarizar@mail.ru>2017-03-22 19:45:32 +0300
committerCarlos Soriano <csoriano@gnome.org>2017-03-22 18:04:41 +0100
commit88d41bb5b57c91b864d6c6d4b2478a2091f6ee5c (patch)
treeb425040cb44e5474a30d01619e6c584eda1cb72b
parent857a90c29b6a91dcad4af4134fb1bc29a5897e31 (diff)
downloadnautilus-88d41bb5b57c91b864d6c6d4b2478a2091f6ee5c.tar.gz
batch rename: Do not consider directory "extensions"
With a batch renaming using a template, the extension is removed. That is, if we have a file named "some.txt", after renaming using template "[Original file name]YOLO" we will get "someYOLO.txt", and this is correct. But if we renaming folders with a name where there is a dot and subsequent symbols, these characters will be mistakenly considered an extension. For example, after renaming folders "file" -> "fileYOLO", "FILEZ." -> "FILEZ.YOLO" (is correct), but "org.package.library" -> "org.packageYOLO.library", "project-2.0" -> "project-2YOLO.0", "my.files" -> "myYOLO.files", "extra-0.85" -> "extra-0YOLO.85" (is incorrect) To fix this bug we won't search extension if current NautilusFile is a directory. https://bugzilla.gnome.org/show_bug.cgi?id=780326
-rw-r--r--src/nautilus-batch-rename-utilities.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/src/nautilus-batch-rename-utilities.c b/src/nautilus-batch-rename-utilities.c
index bb260c545..d7cdbb367 100644
--- a/src/nautilus-batch-rename-utilities.c
+++ b/src/nautilus-batch-rename-utilities.c
@@ -353,7 +353,10 @@ batch_rename_format (NautilusFile *file,
gchar *metadata;
file_name = nautilus_file_get_display_name (file);
- extension = nautilus_file_get_extension (file);
+ if (!nautilus_file_is_directory(file))
+ {
+ extension = nautilus_file_get_extension (file);
+ }
new_name = g_string_new ("");
@@ -430,11 +433,16 @@ batch_rename_format (NautilusFile *file,
{
case ORIGINAL_FILE_NAME:
{
- g_autofree gchar *base_name = NULL;
-
- base_name = eel_filename_strip_extension (file_name);
-
- new_name = g_string_append (new_name, base_name);
+ if (nautilus_file_is_directory(file))
+ {
+ new_name = g_string_append (new_name, file_name);
+ }
+ else
+ {
+ g_autofree gchar *base_name = NULL;
+ base_name = eel_filename_strip_extension (file_name);
+ new_name = g_string_append (new_name, base_name);
+ }
}
break;