[gnome-commander] Fix simple script system for files with spaces
- From: Uwe Scholz <uwescholz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-commander] Fix simple script system for files with spaces
- Date: Sat, 3 Mar 2018 22:38:10 +0000 (UTC)
commit fc9571b14e17e1e720e292c81b37416f414eb83e
Author: Uwe Scholz <u scholz83 gmx de>
Date: Sat Mar 3 23:35:44 2018 +0100
Fix simple script system for files with spaces
src/gnome-cmd-file-popmenu.cc | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/src/gnome-cmd-file-popmenu.cc b/src/gnome-cmd-file-popmenu.cc
index 0576078..d975267 100644
--- a/src/gnome-cmd-file-popmenu.cc
+++ b/src/gnome-cmd-file-popmenu.cc
@@ -301,6 +301,9 @@ static void on_execute_script (GtkMenuItem *menu_item, ScriptData *data)
gdk_window_get_pointer (NULL, NULL, NULL, &mask);
GList *files = data->files;
+
+ string quotationMarks = data->term ? "\\\"" : "\"";
+
if (state_is_shift (mask))
{
// Run script per file
@@ -308,7 +311,7 @@ static void on_execute_script (GtkMenuItem *menu_item, ScriptData *data)
{
GnomeCmdFile *f = (GnomeCmdFile *) files->data;
string command (data->name);
- command.append (" ").append (f->get_name ());
+ command.append (" ").append (quotationMarks).append (f->get_name ()).append (quotationMarks);
run_command_indir (command.c_str (), f->get_dirname (), data->term);
}
@@ -321,7 +324,7 @@ static void on_execute_script (GtkMenuItem *menu_item, ScriptData *data)
for (; files; files = files->next)
{
GnomeCmdFile *f = (GnomeCmdFile *) files->data;
- command.append(f->get_name ()).append(" ");
+ command.append (quotationMarks).append(f->get_name ()).append (quotationMarks).append (" ");
}
run_command_indir (command.c_str (), ((GnomeCmdFile *) data->files->data)->get_dirname (),
data->term);
@@ -747,7 +750,7 @@ GtkWidget *gnome_cmd_file_popmenu_new (GnomeCmdFileList *fl)
{
if (buf.st_mode & S_IFREG)
{
- DEBUG('p', "Adding \'%s\' to the list of scripts.\n", script_path);
+ DEBUG('p', "Adding \'%s\' to the list of scripts.\n", script_path.c_str());
script_list = g_list_append (script_list, g_strdup(directory_entry->d_name));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]