fs/Glob: use PathMatchSpec() on Windows
This commit is contained in:
parent
bc8542503d
commit
2aa54c5365
@ -578,6 +578,11 @@ libfs_a_SOURCES += \
|
|||||||
FS_LIBS += $(ZLIB_LIBS)
|
FS_LIBS += $(ZLIB_LIBS)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if HAVE_WINDOWS
|
||||||
|
# for PathMatchSpec()
|
||||||
|
FS_LIBS += -lshlwapi
|
||||||
|
endif
|
||||||
|
|
||||||
# Storage library
|
# Storage library
|
||||||
|
|
||||||
SMBCLIENT_SOURCES = \
|
SMBCLIENT_SOURCES = \
|
||||||
|
@ -26,6 +26,10 @@
|
|||||||
#define HAVE_CLASS_GLOB
|
#define HAVE_CLASS_GLOB
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
#elif defined(WIN32)
|
||||||
|
#define HAVE_CLASS_GLOB
|
||||||
|
#include <string>
|
||||||
|
#include <shlwapi.h>
|
||||||
#elif defined(HAVE_GLIB)
|
#elif defined(HAVE_GLIB)
|
||||||
#define HAVE_CLASS_GLOB
|
#define HAVE_CLASS_GLOB
|
||||||
#include <glib.h>
|
#include <glib.h>
|
||||||
@ -39,14 +43,14 @@
|
|||||||
* (asterisk and question mark).
|
* (asterisk and question mark).
|
||||||
*/
|
*/
|
||||||
class Glob {
|
class Glob {
|
||||||
#ifdef HAVE_FNMATCH
|
#if defined(HAVE_FNMATCH) || defined(WIN32)
|
||||||
std::string pattern;
|
std::string pattern;
|
||||||
#else
|
#else
|
||||||
GPatternSpec *pattern;
|
GPatternSpec *pattern;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public:
|
public:
|
||||||
#ifdef HAVE_FNMATCH
|
#if defined(HAVE_FNMATCH) || defined(WIN32)
|
||||||
explicit Glob(const char *_pattern)
|
explicit Glob(const char *_pattern)
|
||||||
:pattern(_pattern) {}
|
:pattern(_pattern) {}
|
||||||
|
|
||||||
@ -70,6 +74,8 @@ public:
|
|||||||
bool Check(const char *name_fs) const {
|
bool Check(const char *name_fs) const {
|
||||||
#ifdef HAVE_FNMATCH
|
#ifdef HAVE_FNMATCH
|
||||||
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
|
return fnmatch(pattern.c_str(), name_fs, 0) == 0;
|
||||||
|
#elif defined(WIN32)
|
||||||
|
return PathMatchSpecA(name_fs, pattern.c_str());
|
||||||
#else
|
#else
|
||||||
return g_pattern_match_string(pattern, name_fs);
|
return g_pattern_match_string(pattern, name_fs);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user