[PATCH] Wrong working directory for executed programs



Another small patch at #110407:

Nautilus doesn't chdir to the current view directory when launching
apps, but always uses the path Nautilus was started from (~ most of the
time). This leads to brokenness with everything that relies on the
current working directory to be set correctly (Launcher scripts mainly).

Martin

Index: src/file-manager/fm-directory-view.c
===================================================================
RCS file: /cvs/gnome/nautilus/src/file-manager/fm-directory-view.c,v
retrieving revision 1.619
diff -u -p -w -r1.619 fm-directory-view.c
--- src/file-manager/fm-directory-view.c	7 Apr 2004 03:45:21 -0000	1.619
+++ src/file-manager/fm-directory-view.c	21 May 2004 00:17:36 -0000
@@ -6006,6 +6006,7 @@ activate_callback (NautilusFile *file, g
 	FMDirectoryView *view;
 	char *orig_uri, *uri, *file_uri;
 	char *executable_path, *quoted_path, *name;
+	char *old_working_dir;
 	GnomeVFSMimeActionType action_type;
 	ActivationAction action;
 	GdkScreen *screen;
@@ -6044,6 +6045,8 @@ activate_callback (NautilusFile *file, g
 
 	if (action != ACTIVATION_ACTION_DO_NOTHING && file_is_launchable (file)) {
 
+		old_working_dir = change_to_view_directory (view);
+
 		/* Launch executables to activate them. */
 		action = ACTIVATION_ACTION_LAUNCH;
 		
@@ -6070,6 +6073,8 @@ activate_callback (NautilusFile *file, g
 			g_free (quoted_path);
 		}
 
+		chdir (old_working_dir);
+		g_free (old_working_dir);
 		g_free (executable_path);
 	}
 


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