[glibmm] Treat empty Glib::spawn*() working dir as unset



commit 8a7805cbbe6d268e975669349beb4e82d971537d
Author: Daniel Elstner <danielk openismus com>
Date:   Mon Jul 6 16:36:58 2009 +0200

    Treat empty Glib::spawn*() working dir as unset
    
    * glib/src/spawn.ccg (Glib::spawn_async_with_pipes): If the
    working_directory argument is the empty string, pass a 0 pointer
    to the GLib C API to make it inherit the parent's working directory.
    This is fine as the empty string is not a valid directory name, and
    our documentation already says that it will be interpreted that way.
    (Glib::spawn_async): ditto,
    (Glib::spawn_sync): ditto.

 ChangeLog          |   12 ++++++++++++
 glib/src/spawn.ccg |   12 ++++++------
 2 files changed, 18 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 557aa57..d9e1c90 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2009-07-06  Daniel Elstner  <danielk openismus com>
+
+	Treat empty Glib::spawn*() working dir as unset
+
+	* glib/src/spawn.ccg (Glib::spawn_async_with_pipes): If the
+	working_directory argument is the empty string, pass a 0 pointer
+	to the GLib C API to make it inherit the parent's working directory.
+	This is fine as the empty string is not a valid directory name, and
+	our documentation already says that it will be interpreted that way.
+	(Glib::spawn_async): ditto,
+	(Glib::spawn_sync): ditto.
+
 2009-07-03  José Alburquerque  <jaalburqu svn gnome org>
 
 	* tests/glibmm_valuearray/main.cc: Use references to store casts in
diff --git a/glib/src/spawn.ccg b/glib/src/spawn.ccg
index c9d85a3..10d9d7f 100644
--- a/glib/src/spawn.ccg
+++ b/glib/src/spawn.ccg
@@ -97,7 +97,7 @@ void spawn_async_with_pipes(const std::string& working_directory,
   GError* gerror = 0;
 
   g_spawn_async_with_pipes(
-      working_directory.c_str(),
+      (working_directory.empty()) ? 0 : working_directory.c_str(),
       const_cast<char**>(argv.data()),
       const_cast<char**>(envp.data()),
       static_cast<GSpawnFlags>(unsigned(flags)),
@@ -141,7 +141,7 @@ void spawn_async_with_pipes(const std::string& working_directory,
   GError* gerror = 0;
 
   g_spawn_async_with_pipes(
-      working_directory.c_str(),
+      (working_directory.empty()) ? 0 : working_directory.c_str(),
       const_cast<char**>(argv.data()), 0,
       static_cast<GSpawnFlags>(unsigned(flags)),
       (setup_slot) ? &child_setup_callback : 0,
@@ -180,7 +180,7 @@ void spawn_async(const std::string& working_directory,
   GError* gerror = 0;
 
   g_spawn_async(
-      working_directory.c_str(),
+      (working_directory.empty()) ? 0 : working_directory.c_str(),
       const_cast<char**>(argv.data()),
       const_cast<char**>(envp.data()),
       static_cast<GSpawnFlags>(unsigned(flags)),
@@ -217,7 +217,7 @@ void spawn_async(const std::string& working_directory,
   GError* gerror = 0;
 
   g_spawn_async(
-      working_directory.c_str(),
+      (working_directory.empty()) ? 0 : working_directory.c_str(),
       const_cast<char**>(argv.data()), 0,
       static_cast<GSpawnFlags>(unsigned(flags)),
       (setup_slot) ? &child_setup_callback : 0,
@@ -262,7 +262,7 @@ void spawn_sync(const std::string& working_directory,
   GError* gerror = 0;
 
   g_spawn_sync(
-      working_directory.c_str(),
+      (working_directory.empty()) ? 0 : working_directory.c_str(),
       const_cast<char**>(argv.data()),
       const_cast<char**>(envp.data()),
       static_cast<GSpawnFlags>(unsigned(flags)),
@@ -311,7 +311,7 @@ void spawn_sync(const std::string& working_directory,
   GError* gerror = 0;
 
   g_spawn_sync(
-      working_directory.c_str(),
+      (working_directory.empty()) ? 0 : working_directory.c_str(),
       const_cast<char**>(argv.data()), 0,
       static_cast<GSpawnFlags>(unsigned(flags)),
       (setup_slot) ? &child_setup_callback : 0,



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