[gnome-commander] When a script in the script dir does not contain a name, use the filename in the popup menu, fixing



commit aa5b6b51f42b63a2dbba243878688490ecfd7a6d
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Wed Nov 17 22:58:10 2021 +0100

    When a script in the script dir does not contain a name, use the filename in the popup menu, fixing #108

 src/gnome-cmd-file-popmenu.cc | 2 ++
 1 file changed, 2 insertions(+)
---
diff --git a/src/gnome-cmd-file-popmenu.cc b/src/gnome-cmd-file-popmenu.cc
index ebd8e0dc..3dc6b9df 100644
--- a/src/gnome-cmd-file-popmenu.cc
+++ b/src/gnome-cmd-file-popmenu.cc
@@ -602,6 +602,7 @@ guint add_action_script_entries(GtkUIManager *uiManager, GList *files)
         scriptPath.append ("/").append ((char*) scriptFileName->data);
         scriptData->path = g_strdup (scriptPath.c_str());
 
+        // Try to get the scriptname out of the script, otherwise take the filename
         char *scriptName = nullptr;
         FILE *fileStream = fopen (scriptData->path, "r");
         if (fileStream)
@@ -622,6 +623,7 @@ guint add_action_script_entries(GtkUIManager *uiManager, GList *files)
             }
             fclose (fileStream);
         }
+        scriptName = scriptName ? scriptName : g_strdup((char*) scriptFileName->data);
 
         auto dynAction = gtk_action_new (scriptName, scriptName, nullptr, GTK_STOCK_EXECUTE);
 


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