Avoid warnings when opening a new system file.
authorJohn Darrington <john@darrington.wattle.id.au>
Wed, 15 Apr 2009 23:55:25 +0000 (07:55 +0800)
committerJohn Darrington <john@darrington.wattle.id.au>
Wed, 15 Apr 2009 23:55:25 +0000 (07:55 +0800)
src/ui/gui/psppire-data-window.c

index 52ec0d49b25db95eedcdff6f2924e9b7196e75dd..02b9cc344392859eec2ffdcb63163485eaa4ebf5 100644 (file)
@@ -404,7 +404,17 @@ sysfile_chooser_dialog (PsppireWindow *toplevel)
     gchar *filename = NULL;
     g_object_get (toplevel, "filename", &filename, NULL);
 
-    dir_name = g_path_get_dirname (filename);
+    if ( ! g_path_is_absolute (filename))
+      {
+       gchar *path =
+         g_build_filename (g_get_current_dir (), filename, NULL);
+       dir_name = g_path_get_dirname (path);
+       g_free (path);
+      }
+    else
+      {
+       dir_name = g_path_get_dirname (filename);
+      }
     gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog),
                                         dir_name);
     free (dir_name);