[gnome-terminal] Use g_get_current_dir()



commit d52fe59fb0fadc33dcb16fbdcb4a568ec72eae94
Author: Ryan Lortie <desrt desrt ca>
Date:   Mon Dec 9 12:20:40 2013 -0500

    Use g_get_current_dir()
    
    get_current_dir_name() is a non-portable GNU extension.  Use
    g_get_current_dir() instead, now that it does the same thing (ie:
    respecting the value of PWD).
    
    Bump GLib dependency to make sure we get the new version of the
    function.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705902

 configure.ac   |    2 +-
 src/client.c   |   13 ++-----------
 src/terminal.c |   10 ++--------
 3 files changed, 5 insertions(+), 20 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9f0b464..bd47263 100644
--- a/configure.ac
+++ b/configure.ac
@@ -36,7 +36,7 @@ GNOME_DEBUG_CHECK
 
 AM_GLIB_GNU_GETTEXT
 
-GLIB_REQUIRED=2.32.0
+GLIB_REQUIRED=2.39.2
 GIO_REQUIRED=2.33.2
 GSETTINGS_DESKTOP_SCHEMAS_REQUIRED=0.1.0
 DCONF_REQUIRED=0.12.0
diff --git a/src/client.c b/src/client.c
index cab3531..42d7c03 100644
--- a/src/client.c
+++ b/src/client.c
@@ -517,17 +517,8 @@ parse_arguments (int *argcp,
     return NULL;
   }
 
-  if (data->working_directory == NULL) {
-    char *cwd;
-
-    /* We use get_current_dir_name() here instead of getcwd / g_get_current_dir()
-     * because we want to use the value from PWD (if it is correct).
-     * See bug 502146.
-     */
-    cwd = get_current_dir_name ();
-    data->working_directory = g_strdup (cwd);
-    free (cwd);
-  }
+  if (data->working_directory == NULL)
+    data->working_directory = g_get_current_dir ();
 
   /* Do this here so that gdk_display is initialized */
   if (data->startup_id == NULL)
diff --git a/src/terminal.c b/src/terminal.c
index e317574..afd2523 100644
--- a/src/terminal.c
+++ b/src/terminal.c
@@ -202,7 +202,7 @@ int
 main (int argc, char **argv)
 {
   int i;
-  char **argv_copy, *cwd;
+  char **argv_copy;
   const char *startup_id, *display_name;
   GdkDisplay *display;
   TerminalOptions *options;
@@ -229,13 +229,7 @@ main (int argc, char **argv)
 
   startup_id = g_getenv ("DESKTOP_STARTUP_ID");
 
-  /* We use get_current_dir_name() here instead of getcwd / g_get_current_dir()
-   * because we want to use the value from PWD (if it is correct).
-   * See bug 502146.
-   */
-  cwd = get_current_dir_name ();
-  working_directory = g_strdup (cwd);
-  free (cwd);
+  working_directory = g_get_current_dir ();
 
   options = terminal_options_parse (working_directory,
                                     startup_id,


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