diff options
Diffstat (limited to 'ArchiveEx/dat.cpp')
-rw-r--r-- | ArchiveEx/dat.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/ArchiveEx/dat.cpp b/ArchiveEx/dat.cpp index 9662cbc..6df04bc 100644 --- a/ArchiveEx/dat.cpp +++ b/ArchiveEx/dat.cpp @@ -1,4 +1,9 @@ +#ifdef WIN32 +#include <shlwapi.h> +#else #include <fnmatch.h> +#endif + #include <unistd.h> #include <cstdint> @@ -174,8 +179,11 @@ FilterFile(const std::vector<std::string>& patterns, std::function<void(const ch if (patterns.empty()) return func(name); for (const auto& pattern : patterns) { - const int match = fnmatch(pattern.c_str(), name, FNM_PATHNAME | FNM_LEADING_DIR); - if (match == 0) +#ifdef WIN32 + if (PathMatchSpecA(name, pattern.c_str())) +#else + if (0 == fnmatch(pattern.c_str(), name, FNM_PATHNAME | FNM_LEADING_DIR)) +#endif return func(name); } }; @@ -192,7 +200,7 @@ UpdateFile(ArchiveEx::Archive& archive, const std::string& path, bool warn) break; case fs::file_type::directory: for (const auto& entry : fs::directory_iterator{path}) - UpdateFile(archive, entry.path(), false); + UpdateFile(archive, entry.path().string(), false); break; default: if (warn) |