[nautilus-actions] Only check for non-empty path+parameters (fix #614596)



commit 35cc18e44dafd0ededa35f76f57f7c133f516b6d
Author: Pierre Wieser <pwieser trychlos org>
Date:   Fri Apr 9 02:19:22 2010 +0200

    Only check for non-empty path+parameters (fix #614596)
    
    Historical behavior was to not check path nor parameters at all.
    2.29.x serie, and up to 2.30.0, have tried to check an actual executable path.
    But most of already actions only used a command, relying on the PATH env variable.
    So, starting with 2.30.1, we only check for non empty path+parameters.

 ChangeLog                    |    3 +++
 TODO                         |    2 ++
 src/core/na-object-profile.c |   16 +++++++++-------
 3 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index b9d6955..39656e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-04-08 Pierre Wieser <pwieser trychlos org>
 
+	* src/core/na-object-profile.c (is_valid_path_parameters):
+	Only check for non-empty path+parameters (fix #614596).
+
 	* src/nact/nact-sort-buttons.c (on_sort_down_button_toggled,
 	on_sort_manual_button_toggled, on_sort_up_button_toggled):
 	Do not let the user click twice on a sort button.
diff --git a/TODO b/TODO
index 44c0b30..25df348 100644
--- a/TODO
+++ b/TODO
@@ -144,3 +144,5 @@
   http://library.gnome.org/devel/gconf/unstable/gconf-gconf.html#gconf-concat-dir-and-key
 
 - "x-nautilus-desktop:///" is rather a scheme than a folder
+
+- enhancement.ui: add a 'why this item is invalid' 
diff --git a/src/core/na-object-profile.c b/src/core/na-object-profile.c
index 73e090a..ff0b85c 100644
--- a/src/core/na-object-profile.c
+++ b/src/core/na-object-profile.c
@@ -361,25 +361,27 @@ profile_is_valid( const NAObjectProfile *profile )
 	return( is_valid );
 }
 
+/*
+ * historical behavior was to not check path nor parameters at all
+ * 2.29.x serie, and up to 2.30.0, have tried to check an actual executable path
+ * but most of already actions only used a command, relying on the PATH env variable
+ * so, starting with 2.30.1, we only check for non empty path+parameters
+ */
 static gboolean
 is_valid_path_parameters( const NAObjectProfile *profile )
 {
 	gboolean valid;
 	gchar *path, *parameters;
-	gchar *command, *exe;
+	gchar *command;
 
 	path = na_object_get_path( profile );
 	parameters = na_object_get_parameters( profile );
 
 	command = g_strdup_printf( "%s %s", path, parameters );
-	exe = na_core_utils_str_get_first_word( command );
+	g_strstrip( command );
 
-	valid =
-		g_file_test( exe, G_FILE_TEST_EXISTS ) &&
-		g_file_test( exe, G_FILE_TEST_IS_EXECUTABLE ) &&
-		!g_file_test( exe, G_FILE_TEST_IS_DIR );
+	valid = g_utf8_strlen( command, -1 ) > 0;
 
-	g_free( exe );
 	g_free( command );
 	g_free( parameters );
 	g_free( path );



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