X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/96be256b3e1802de10f45953c41ed33bce399b54..222702b112dcc7bebe018d6f4d66fe469fefd02c:/src/motif/filedlg.cpp diff --git a/src/motif/filedlg.cpp b/src/motif/filedlg.cpp index 1f6746ce6c..1945cadf3a 100644 --- a/src/motif/filedlg.cpp +++ b/src/motif/filedlg.cpp @@ -100,18 +100,19 @@ static wxString ParseWildCard( const wxString& wild ) _T("wildcard syntax"); #endif - wxStringTokenizer tok( wild, _T("|") ); - - wxCHECK_MSG( tok.CountTokens() <= 2, _T("*.*"), msg ); - - if( tok.CountTokens() == 1 ) return wild; - - // CountTokens == 2 - tok.GetNextToken(); - wxStringTokenizer tok2( tok.GetNextToken(), _T(";") ); - - wxCHECK_MSG( tok2.CountTokens() == 1, tok2.GetNextToken(), msg ); - return tok2.GetNextToken(); + wxArrayString wildDescriptions, wildFilters; + const size_t count = wxParseCommonDialogsFilter(wild, + wildDescriptions, + wildFilters); + wxCHECK_MSG( count, _T("*.*"), wxT("wxFileDialog: bad wildcard string") ); + wxCHECK_MSG( count == 1, _T("*.*"), msg ); + + // check for *.txt;*.rtf + wxStringTokenizer tok2( wildFilters[0], _T(";") ); + wxString wildcard = tok2.GetNextToken(); + + wxCHECK_MSG( tok2.CountTokens() <= 1, wildcard, msg ); + return wildcard; } wxFileDialog::wxFileDialog(wxWindow *parent, const wxString& message,