diff options
author | John Sullivan <sullivan@src.gnome.org> | 2001-03-20 21:06:35 +0000 |
---|---|---|
committer | John Sullivan <sullivan@src.gnome.org> | 2001-03-20 21:06:35 +0000 |
commit | 13a6070f0db76d1a8edd453e321ed8f0c45b9268 (patch) | |
tree | f96ac79096de5ce764f70a4e0cfd3ee6f7e1e831 | |
parent | baf6d3741cbf8786f07ae350689ccfdade74bed5 (diff) | |
download | nautilus-13a6070f0db76d1a8edd453e321ed8f0c45b9268.tar.gz |
shell-quote the script name. Fixes bug Robin found where scripts with
* src/file-manager/fm-directory-view.c: (run_script_callback):
shell-quote the script name. Fixes bug Robin found where scripts
with spaces in their names didn't work.
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | src/file-manager/fm-directory-view.c | 10 |
2 files changed, 13 insertions, 3 deletions
@@ -1,5 +1,11 @@ 2001-03-20 John Sullivan <sullivan@eazel.com> + * src/file-manager/fm-directory-view.c: (run_script_callback): + shell-quote the script name. Fixes bug Robin found where scripts + with spaces in their names didn't work. + +2001-03-20 John Sullivan <sullivan@eazel.com> + reviewed by: Pavel Cisler <pavel@eazel.com> Finished bug 4875 (design for running arbitrary scripts on diff --git a/src/file-manager/fm-directory-view.c b/src/file-manager/fm-directory-view.c index 38e46aed5..cdc2edf83 100644 --- a/src/file-manager/fm-directory-view.c +++ b/src/file-manager/fm-directory-view.c @@ -3361,6 +3361,7 @@ run_script_callback (BonoboUIComponent *component, gpointer callback_data, const GList *selected_files; char *file_uri; char *local_file_path; + char *quoted_path; char *old_working_dir; char *parameters, *command; @@ -3371,6 +3372,9 @@ run_script_callback (BonoboUIComponent *component, gpointer callback_data, const g_assert (local_file_path != NULL); g_free (file_uri); + quoted_path = nautilus_shell_quote (local_file_path); + g_free (local_file_path); + old_working_dir = change_to_view_directory (launch_parameters->directory_view); selected_files = fm_directory_view_get_selection (launch_parameters->directory_view); @@ -3383,13 +3387,13 @@ run_script_callback (BonoboUIComponent *component, gpointer callback_data, const * quotes all parameters as if they are a single parameter. Should add or change API in * nautilus-program-choosing.c to support multiple parameters. */ - command = g_strconcat (local_file_path, " ", parameters, NULL); + command = g_strconcat (quoted_path, " ", parameters, NULL); g_free (parameters); } else { /* We pass no parameters in the remote case. It's up to scripts to be smart * and check the environment variables. */ - command = g_strdup (local_file_path); + command = g_strdup (quoted_path); } /* FIXME: handle errors with dialog? Or leave up to each script? */ @@ -3400,7 +3404,7 @@ run_script_callback (BonoboUIComponent *component, gpointer callback_data, const unset_script_environment_variables (); chdir (old_working_dir); g_free (old_working_dir); - g_free (local_file_path); + g_free (quoted_path); } static void |