[nautilus/gnome-3-26] Only append .desktop if it doesn't already exist



commit b4d68459a1ac7b6bb62bcd3d889a18d004fc95f0
Author: Michael Murphy <mmstickman gmail com>
Date:   Wed May 30 08:44:57 2018 -0600

    Only append .desktop if it doesn't already exist

 src/nautilus-file.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/src/nautilus-file.c b/src/nautilus-file.c
index d6ac35a44..1657edcde 100644
--- a/src/nautilus-file.c
+++ b/src/nautilus-file.c
@@ -2164,7 +2164,14 @@ nautilus_file_can_rename_file (NautilusFile                  *file,
             g_error_free (error);
             return NULL;
         }
-        new_file_name = g_strdup_printf ("%s.desktop", new_name);
+
+        /* Only append `.desktop` if it doesn't already exist. */
+        if (g_str_has_suffix (new_name, ".desktop")) {
+            new_file_name = g_strdup (new_name);
+        } else {
+            new_file_name = g_strdup_printf ("%s.desktop", new_name);
+        }
+
         new_file_name = g_strdelimit (new_file_name, "/", '-');
 
         if (name_is (file, new_file_name))


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]