Batch #868 by ragnarok-clanker: 0 byte-identical, 2 confirmed by peer review. - fn_18246 EnumerateFileNames: logic confirmed by peer review - fn_18247 EnumerateFileNames: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/File/FileEnumeration.cpp
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#include "File/FileEnumeration.h"
|
|
|
|
#include <windows.h>
|
|
|
|
// FUNCTION: fn_18246
|
|
void EnumerateFileNames(std::list<std::string>& names, const char* directory, const char* pattern) {
|
|
std::string search(directory);
|
|
search.append(pattern);
|
|
WIN32_FIND_DATAA found{};
|
|
HANDLE handle = FindFirstFileA(search.c_str(), &found);
|
|
if (handle == INVALID_HANDLE_VALUE) {
|
|
FindClose(handle);
|
|
return;
|
|
}
|
|
|
|
do {
|
|
if (found.cFileName[0] == '.' && (found.cFileName[1] == 0 || (found.cFileName[1] == '.' && found.cFileName[2] == 0))) {
|
|
continue;
|
|
}
|
|
names.push_back(std::string(found.cFileName));
|
|
} while (FindNextFileA(handle, &found));
|
|
FindClose(handle);
|
|
}
|
|
|
|
// FUNCTION: fn_18247
|
|
void EnumerateFileNames(std::vector<std::string>& names, const char* directory, const char* pattern) {
|
|
std::string search(directory);
|
|
search.append(pattern);
|
|
WIN32_FIND_DATAA found{};
|
|
HANDLE handle = FindFirstFileA(search.c_str(), &found);
|
|
if (handle == INVALID_HANDLE_VALUE) {
|
|
FindClose(handle);
|
|
return;
|
|
}
|
|
|
|
do {
|
|
if (found.cFileName[0] == '.' && (found.cFileName[1] == 0 || (found.cFileName[1] == '.' && found.cFileName[2] == 0))) {
|
|
continue;
|
|
}
|
|
names.push_back(std::string(found.cFileName));
|
|
} while (FindNextFileA(handle, &found));
|
|
FindClose(handle);
|
|
}
|