]> git.saurik.com Git - wxWidgets.git/commitdiff
Ignore setting empty path in wxGTK wxFileDialog.
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 29 Feb 2012 14:45:29 +0000 (14:45 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 29 Feb 2012 14:45:29 +0000 (14:45 +0000)
wxGenericFileButton calls wxFileDialog::SetPath() with empty path if no
initial path is explicitly specified and this clearly shouldn't do anything --
but it did, as it set the file dialog path to the initial directory (cwd by
default), and so opened it in the parent of that directory which was
completely unexpected and not useful at all.

Simply don't do anything when SetPath("") is called.

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

src/gtk/filedlg.cpp

index 51dadd12ee5fce38a58864aa96c7b3f53222a43d..85118048ed0c0f70e5a6139042dd113425b39fed 100644 (file)
@@ -371,6 +371,12 @@ void wxFileDialog::SetMessage(const wxString& message)
 
 void wxFileDialog::SetPath(const wxString& path)
 {
+    // Don't do anything if no path is specified, in particular don't set the
+    // path to m_dir below as this would result in opening the dialog in the
+    // parent directory of this one instead of m_dir itself.
+    if ( path.empty() )
+        return;
+
     // we need an absolute path for GTK native chooser so ensure that we have
     // it: use the initial directory if it was set or just CWD otherwise (this
     // is the default behaviour if m_dir is empty)