Restore case-insensitivity for file name matching under Windows.
This was broken by the changes of r73790, see #3432. Fix this by converting both the file name and the wildcard mask to the upper case before checking whether the former matches the latter. Closes #15243. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74243 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -77,8 +77,22 @@ const wxChar *GetNameFromFindData(const FIND_STRUCT *finddata)
|
|||||||
inline bool
|
inline bool
|
||||||
CheckFoundMatch(const FIND_STRUCT* finddata, const wxString& filter)
|
CheckFoundMatch(const FIND_STRUCT* finddata, const wxString& filter)
|
||||||
{
|
{
|
||||||
return filter.empty() ||
|
// If there is no filter, the found file must be the one we really are
|
||||||
wxString(GetNameFromFindData(finddata)).Matches(filter);
|
// looking for.
|
||||||
|
if ( filter.empty() )
|
||||||
|
return true;
|
||||||
|
|
||||||
|
// Otherwise do check the match validity. Notice that we must do it
|
||||||
|
// case-insensitively because the case of the file names is not supposed to
|
||||||
|
// matter under Windows.
|
||||||
|
wxString fn(GetNameFromFindData(finddata));
|
||||||
|
|
||||||
|
// However if the filter contains only special characters (which is a
|
||||||
|
// common case), we can skip the case conversion.
|
||||||
|
if ( filter.find_first_not_of(wxS("*?.")) == wxString::npos )
|
||||||
|
return fn.Matches(filter);
|
||||||
|
|
||||||
|
return fn.MakeUpper().Matches(filter.Upper());
|
||||||
}
|
}
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
|
Reference in New Issue
Block a user