mirror of
https://github.com/Blinue/Magpie.git
synced 2026-06-24 02:04:10 +00:00
fix: 修复遍历缓存文件的错误
This commit is contained in:
parent
97de78a6dc
commit
6760a2c869
1 changed files with 6 additions and 4 deletions
|
|
@ -269,10 +269,11 @@ void EffectCacheManager::Save(std::string_view effectName, std::string_view hash
|
|||
std::wregex regex(fmt::format(L"^{}_{:02x}[0-9,a-f]{{{}}}$", StrUtils::UTF8ToUTF16(effectName), desc.flags,
|
||||
Utils::Hasher::Get().GetHashLength() * 2), std::wregex::optimize | std::wregex::nosubs);
|
||||
|
||||
WIN32_FIND_DATA findData;
|
||||
HANDLE hFind = Utils::SafeHandle(FindFirstFile(StrUtils::ConcatW(CACHE_DIR, L"\\*").c_str(), &findData));
|
||||
WIN32_FIND_DATA findData{};
|
||||
HANDLE hFind = Utils::SafeHandle(FindFirstFileEx(StrUtils::ConcatW(CACHE_DIR, L"\\*").c_str(),
|
||||
FindExInfoBasic, &findData, FindExSearchNameMatch, nullptr, FIND_FIRST_EX_LARGE_FETCH));
|
||||
if (hFind) {
|
||||
while (FindNextFile(hFind, &findData)) {
|
||||
do {
|
||||
if (StrUtils::StrLen(findData.cFileName) < 8) {
|
||||
continue;
|
||||
}
|
||||
|
|
@ -286,7 +287,8 @@ void EffectCacheManager::Save(std::string_view effectName, std::string_view hash
|
|||
Logger::Get().Win32Error(StrUtils::Concat("删除缓存文件 ",
|
||||
StrUtils::UTF16ToUTF8(findData.cFileName), " 失败"));
|
||||
}
|
||||
}
|
||||
} while (FindNextFile(hFind, &findData));
|
||||
|
||||
FindClose(hFind);
|
||||
} else {
|
||||
Logger::Get().Win32Error("查找缓存文件失败");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue