From 42ed9de2921e8c8d2c7f3ab04ce1713b4f975e6f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Jun 2013 12:51:01 +0000 Subject: [PATCH] Don't append just a dot in wxGTK wxFileDialog if no default extension. We always appended the default extension (for the currently selected pattern) to the file name but this was the wrong thing to do if there was no extension at all as this resulted in appending just a dot to the filename. So only do it if there is an extension to append. Closes #15285. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74307 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/filedlg.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/gtk/filedlg.cpp b/src/gtk/filedlg.cpp index 6f3b775..1d13bb6 100644 --- a/src/gtk/filedlg.cpp +++ b/src/gtk/filedlg.cpp @@ -268,11 +268,11 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message, if ( !wildCard.empty() && !defaultFileName.empty() && !wxFileName(defaultFileName).HasExt() ) { - // append the default extension to the initial file name: GTK won't do - // it for us by default (unlike e.g. MSW) - const wxString defaultExt = m_fc.GetCurrentWildCard().AfterFirst('.'); - if ( defaultExt.find_first_of("?*") == wxString::npos ) - defaultFileNameWithExt += "." + defaultExt; + // append the default extension, if any, to the initial file name: GTK + // won't do it for us by default (unlike e.g. MSW) + const wxFileName fnWC(m_fc.GetCurrentWildCard()); + if ( fnWC.HasExt() ) + defaultFileNameWithExt << "." << fnWC.GetExt(); } -- 2.7.4