gnome-commander r1585 - in branches/gcmd-1-3: . src



Author: epiotr
Date: Mon Feb 25 16:36:52 2008
New Revision: 1585
URL: http://svn.gnome.org/viewvc/gnome-commander?rev=1585&view=rev

Log:
Yet another fix for setting exec dir for started MIME applications

Modified:
   branches/gcmd-1-3/ChangeLog
   branches/gcmd-1-3/src/utils.cc

Modified: branches/gcmd-1-3/src/utils.cc
==============================================================================
--- branches/gcmd-1-3/src/utils.cc	(original)
+++ branches/gcmd-1-3/src/utils.cc	Mon Feb 25 16:36:52 2008
@@ -21,6 +21,9 @@
 #include <locale.h>
 #include <errno.h>
 #include <dirent.h>
+
+#include <set>
+
 #include "gnome-cmd-includes.h"
 #include "utils.h"
 #include "gnome-cmd-data.h"
@@ -606,13 +609,24 @@
     {
         string cmd = gnome_cmd_app_get_command (app);
 
+        set<string> dirs;
+
         for (; files; files = files->next)
         {
             cmd += ' ';
             cmd += stringify (g_shell_quote ((gchar *) files->data));
+
+            gchar *dpath = g_path_get_dirname ((gchar *) files->data);
+
+            if (dpath)
+                dirs.insert (stringify (dpath));
         }
 
-        run_command (cmd.c_str(), gnome_cmd_app_get_requires_terminal (app));
+        if (dirs.size()==1)
+            run_command_indir (cmd.c_str(), dirs.begin()->c_str(), gnome_cmd_app_get_requires_terminal (app));
+        else
+            run_command (cmd.c_str(), gnome_cmd_app_get_requires_terminal (app));
+
         g_list_free (files);
     }
 



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