aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2015-06-22 21:18:40 +0200
committerMax Kellermann <max@duempel.org>2015-06-22 22:12:08 +0200
commit2aa54c53653abda99c72bfb007c3442a1c3c6d60 (patch)
treea2831dae3a983fe6a0f84e378033b850c101ea76 /src
parentbc8542503d5b99c1bf2d5d2748e49d9257e3fd25 (diff)
downloadmpd-2aa54c53653abda99c72bfb007c3442a1c3c6d60.tar.gz
mpd-2aa54c53653abda99c72bfb007c3442a1c3c6d60.tar.xz
mpd-2aa54c53653abda99c72bfb007c3442a1c3c6d60.zip
fs/Glob: use PathMatchSpec() on Windows
Diffstat (limited to 'src')
-rw-r--r--src/fs/Glob.hxx10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fs/Glob.hxx b/src/fs/Glob.hxx
index b7307feea..e0909bd38 100644
--- a/src/fs/Glob.hxx
+++ b/src/fs/Glob.hxx
@@ -26,6 +26,10 @@
#define HAVE_CLASS_GLOB
#include <string>
#include <fnmatch.h>
+#elif defined(WIN32)
+#define HAVE_CLASS_GLOB
+#include <string>
+#include <shlwapi.h>
#elif defined(HAVE_GLIB)
#define HAVE_CLASS_GLOB
#include <glib.h>
@@ -39,14 +43,14 @@
* (asterisk and question mark).
*/
class Glob {
-#ifdef HAVE_FNMATCH
+#if defined(HAVE_FNMATCH) || defined(WIN32)
std::string pattern;
#else
GPatternSpec *pattern;
#endif
public:
-#ifdef HAVE_FNMATCH
+#if defined(HAVE_FNMATCH) || defined(WIN32)
explicit Glob(const char *_pattern)
:pattern(_pattern) {}
@@ -70,6 +74,8 @@ public:
bool Check(const char *name_fs) const {
#ifdef HAVE_FNMATCH
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
+#elif defined(WIN32)
+ return PathMatchSpecA(name_fs, pattern.c_str());
#else
return g_pattern_match_string(pattern, name_fs);
#endif