Interpret default file name relatively to initial dir in wxGTK wxFileDialog.

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
This commit is contained in:
Vadim Zeitlin
2012-02-28 02:04:57 +00:00
parent 54c45be005
commit 257d35aead

View 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());
}