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