From d1aba6dbbd42dde5020a4f377d3c1effb6ee6e5e Mon Sep 17 00:00:00 2001 From: Stefan Csomor Date: Wed, 21 Aug 2002 16:06:44 +0000 Subject: [PATCH] fix for single item wildcards with no explanatory name item git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@16652 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/mac/carbon/filedlg.cpp | 16 ++++++++++------ src/mac/filedlg.cpp | 16 ++++++++++------ 2 files changed, 20 insertions(+), 12 deletions(-) diff --git a/src/mac/carbon/filedlg.cpp b/src/mac/carbon/filedlg.cpp index bdcbdbe2c9..cef71e0136 100644 --- a/src/mac/carbon/filedlg.cpp +++ b/src/mac/carbon/filedlg.cpp @@ -144,12 +144,16 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) current += filter2.GetChar(i) ; } } -// if ( filterIndex > 0 ) - { - wxASSERT_MSG( !isName , "incorrect format of format string" ) ; - myData->extensions[filterIndex] = current.MakeUpper() ; - ++filterIndex ; - } + // we allow for compatibility reason to have a single filter expression (like *.*) without + // an explanatory text, in that case the first part is name and extension at the same time + + wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ; + if ( current.IsEmpty() ) + myData->extensions[filterIndex] = myData->name[filterIndex] ; + else + myData->extensions[filterIndex] = current.MakeUpper() ; + ++filterIndex ; + myData->numfilters = filterIndex ; for ( int i = 0 ; i < myData->numfilters ; i++ ) diff --git a/src/mac/filedlg.cpp b/src/mac/filedlg.cpp index bdcbdbe2c9..cef71e0136 100644 --- a/src/mac/filedlg.cpp +++ b/src/mac/filedlg.cpp @@ -144,12 +144,16 @@ void MakeUserDataRec(OpenUserDataRec *myData , const wxString& filter ) current += filter2.GetChar(i) ; } } -// if ( filterIndex > 0 ) - { - wxASSERT_MSG( !isName , "incorrect format of format string" ) ; - myData->extensions[filterIndex] = current.MakeUpper() ; - ++filterIndex ; - } + // we allow for compatibility reason to have a single filter expression (like *.*) without + // an explanatory text, in that case the first part is name and extension at the same time + + wxASSERT_MSG( filterIndex == 0 || !isName , "incorrect format of format string" ) ; + if ( current.IsEmpty() ) + myData->extensions[filterIndex] = myData->name[filterIndex] ; + else + myData->extensions[filterIndex] = current.MakeUpper() ; + ++filterIndex ; + myData->numfilters = filterIndex ; for ( int i = 0 ; i < myData->numfilters ; i++ ) -- 2.45.2