X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7f555861b7e50f335c7b929bb76be38e9ebd69c5..520e470fdd0daef09c77938db642e4583933c90d:/src/common/filefn.cpp diff --git a/src/common/filefn.cpp b/src/common/filefn.cpp index 52af1f7b4c..9f61baf66d 100644 --- a/src/common/filefn.cpp +++ b/src/common/filefn.cpp @@ -70,6 +70,11 @@ #include #endif +#include "wx/setup.h" +#ifdef HAVE_FNMATCH_H +#include "fnmatch.h" +#endif + #ifdef __WINDOWS__ #include "windows.h" #endif @@ -1392,8 +1397,20 @@ bool wxIsWild( const wxString& pattern ) return FALSE; }; - bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) +#ifdef HAVE_FNMATCH_H +{ + if(dot_special) + return fnmatch(pat.c_str(), text.c_str(), FNM_PERIOD) == 0; + else + return fnmatch(pat.c_str(), text.c_str(), 0) == 0; +} +#else + +#pragma error Broken implementation of wxMatchWild() -- needs fixing! + /* + * WARNING: this code is broken! + */ { wxString tmp1 = pat; char *pattern = WXSTRINGCAST(tmp1); @@ -1527,4 +1544,5 @@ bool wxMatchWild( const wxString& pat, const wxString& text, bool dot_special ) pattern++; return ((*str == '\0') && (*pattern == '\0')); }; +#endif