]> git.saurik.com Git - wxWidgets.git/commitdiff
Interpret default file name relatively to initial dir in wxGTK wxFileDialog.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 28 Feb 2012 02:04:57 +0000 (02:04 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 28 Feb 2012 02:04:57 +0000 (02:04 +0000)
Use the initial dialog directory to build the absolute path required by GTK+
in wxFileDialog instead of the current working directory. This makes more
sense and makes specifying the default directory and (just) the default file
name work correctly and avoids GTK+ warnings like

Gtk-CRITICAL **: gtk_file_folder_unix_get_info: assertion `strcmp (dirname, folder_unix->filename) == 0' failed

(and in some older versions of GTK+ -- 2.10? -- this even results in a crash).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70731 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/filedlg.cpp

index 6ba83203126033ef0587a241c8b73c81c565316a..51dadd12ee5fce38a58864aa96c7b3f53222a43d 100644 (file)
@@ -372,9 +372,10 @@ void wxFileDialog::SetMessage(const wxString& message)
 void wxFileDialog::SetPath(const wxString& path)
 {
     // we need an absolute path for GTK native chooser so ensure that we have
-    // it
+    // it: use the initial directory if it was set or just CWD otherwise (this
+    // is the default behaviour if m_dir is empty)
     wxFileName fn(path);
-    fn.MakeAbsolute();
+    fn.MakeAbsolute(m_dir);
     m_fc.SetPath(fn.GetFullPath());
 }