Fix linux auto rom detection for built-in extractor (#842)

This commit is contained in:
Archez
2024-11-12 11:13:44 -05:00
committed by GitHub
parent cf92349436
commit 31685557d2
+6 -2
View File
@@ -215,14 +215,18 @@ void Extractor::GetRoms(std::vector<std::string>& roms) {
while ((dir = readdir(d)) != NULL) {
struct stat path;
auto fullPath = std::filesystem::path(mSearchPath) / dir->d_name;
auto fullPathString = fullPath.string();
const char* fullPathCStr = fullPathString.c_str();
// Check if current entry is not folder
stat(dir->d_name, &path);
stat(fullPathCStr, &path);
if (S_ISREG(path.st_mode)) {
// Get the position of the extension character.
char* ext = strrchr(dir->d_name, '.');
if (ext != NULL && (strcmp(ext, ".z64") == 0 || strcmp(ext, ".n64") == 0 || strcmp(ext, ".v64") == 0)) {
roms.push_back(dir->d_name);
roms.push_back(fullPathCStr);
}
}
}