diff --git a/Plugins/PluginFileView/PluginFileView.cpp b/Plugins/PluginFileView/PluginFileView.cpp index d02ac923..5c7c20db 100644 --- a/Plugins/PluginFileView/PluginFileView.cpp +++ b/Plugins/PluginFileView/PluginFileView.cpp @@ -44,7 +44,6 @@ typedef struct // 22 bytes #pragma pack(pop) unsigned __stdcall SystemThreadProc(void* pParam); -void EscapeRegex(std::wstring& regex); void GetFolderInfo(std::queue& folderQueue, std::wstring& folder, ParentMeasure* parent, RecursiveType rType); void GetIcon(std::wstring filePath, const std::wstring& iconPath, IconSize iconSize); HRESULT SaveIcon(HICON hIcon, FILE* fp); @@ -741,11 +740,6 @@ unsigned __stdcall SystemThreadProc(void* pParam) std::wstring folder = tmp->path; RecursiveType rType = tmp->recursiveType; - if (rType == RECURSIVE_FULL && tmp->wildcardSearch != L"*") - { - EscapeRegex(tmp->wildcardSearch); - } - GetFolderInfo(folderQueue, folder, tmp, (rType == RECURSIVE_PARTIAL) ? RECURSIVE_NONE : rType); while (rType != RECURSIVE_NONE && !folderQueue.empty()) @@ -912,37 +906,6 @@ unsigned __stdcall SystemThreadProc(void* pParam) return 0; } -void EscapeRegex(std::wstring& regex) -{ - auto replace = [®ex](std::wstring from, std::wstring to) - { - size_t start = 0; - while ((start = regex.find(from, start)) != std::wstring::npos) - { - regex.replace(start, from.size(), to); - start += to.size(); - } - }; - - replace(L"\\", L"\\\\"); - replace(L"^", L"\\^"); - replace(L"$", L"\\$"); - replace(L"|", L"\\|"); - replace(L"(", L"\\("); - replace(L")", L"\\)"); - replace(L"[", L"\\["); - replace(L"]", L"\\]"); - replace(L".", L"\\."); - replace(L"+", L"\\+"); - replace(L"/", L"\\/"); - replace(L"&", L"\\&"); - replace(L"{", L"\\{"); - replace(L"}", L"\\}"); - - replace(L"*", L".*"); - replace(L"?", L"."); -} - void GetFolderInfo(std::queue& folderQueue, std::wstring& folder, ParentMeasure* parent, RecursiveType rType) { std::wstring path = folder; @@ -969,8 +932,7 @@ void GetFolderInfo(std::queue& folderQueue, std::wstring& folder, if (rType == RECURSIVE_FULL && parent->wildcardSearch != L"*" && !file.isFolder) { - std::wregex pattern(parent->wildcardSearch, std::wregex::icase | std::wregex::optimize); - if (!std::regex_match(file.fileName, pattern)) + if (!PathMatchSpec(file.fileName.c_str(), parent->wildcardSearch.c_str())) { continue; } diff --git a/Plugins/PluginFileView/PluginFileView.vcxproj b/Plugins/PluginFileView/PluginFileView.vcxproj index 771bf0e3..2e2f3c60 100644 --- a/Plugins/PluginFileView/PluginFileView.vcxproj +++ b/Plugins/PluginFileView/PluginFileView.vcxproj @@ -23,6 +23,9 @@ + + Shlwapi.lib;%(AdditionalDependencies) + @@ -31,6 +34,9 @@ + + Shlwapi.lib;%(AdditionalDependencies) + @@ -39,6 +45,9 @@ + + Shlwapi.lib;%(AdditionalDependencies) + @@ -47,6 +56,9 @@ + + Shlwapi.lib;%(AdditionalDependencies) + diff --git a/Plugins/PluginFileView/StdAfx.h b/Plugins/PluginFileView/StdAfx.h index cd0b274b..b932eac0 100644 --- a/Plugins/PluginFileView/StdAfx.h +++ b/Plugins/PluginFileView/StdAfx.h @@ -24,12 +24,12 @@ #include #include #include +#include // STL #include #include #include -#include #include // Rainmeter API