]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/filepicker.cpp
Fix crash in wxDC::GetMultiLineTextExtent() after last commit.
[wxWidgets.git] / src / gtk / filepicker.cpp
index 213b1e1a8eb2f2015acb9d168a5f2d728b1bfe37..f93d3428f29658c09f992daa7543b077aea3d813 100644 (file)
@@ -131,7 +131,15 @@ void wxFileButton::SetPath(const wxString &str)
 void wxFileButton::SetInitialDirectory(const wxString& dir)
 {
     if (m_dialog)
 void wxFileButton::SetInitialDirectory(const wxString& dir)
 {
     if (m_dialog)
-        DoSetInitialDirectory(static_cast<wxFileDialog*>(m_dialog), dir);
+    {
+        // Only change the directory if the default file name doesn't have any
+        // directory in it, otherwise it takes precedence.
+        if ( m_path.find_first_of(wxFileName::GetPathSeparators()) ==
+                wxString::npos )
+        {
+            static_cast<wxFileDialog*>(m_dialog)->SetDirectory(dir);
+        }
+    }
     else
         wxGenericFileButton::SetInitialDirectory(dir);
 }
     else
         wxGenericFileButton::SetInitialDirectory(dir);
 }