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
This commit is contained in:
@@ -268,11 +268,11 @@ bool wxFileDialog::Create(wxWindow *parent, const wxString& message,
|
|||||||
if ( !wildCard.empty() && !defaultFileName.empty() &&
|
if ( !wildCard.empty() && !defaultFileName.empty() &&
|
||||||
!wxFileName(defaultFileName).HasExt() )
|
!wxFileName(defaultFileName).HasExt() )
|
||||||
{
|
{
|
||||||
// append the default extension to the initial file name: GTK won't do
|
// append the default extension, if any, to the initial file name: GTK
|
||||||
// it for us by default (unlike e.g. MSW)
|
// won't do it for us by default (unlike e.g. MSW)
|
||||||
const wxString defaultExt = m_fc.GetCurrentWildCard().AfterFirst('.');
|
const wxFileName fnWC(m_fc.GetCurrentWildCard());
|
||||||
if ( defaultExt.find_first_of("?*") == wxString::npos )
|
if ( fnWC.HasExt() )
|
||||||
defaultFileNameWithExt += "." + defaultExt;
|
defaultFileNameWithExt << "." << fnWC.GetExt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user