Skip to content

Commit

Permalink
Fix linux auto rom detection for built-in extractor (HarbourMasters#842)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archez authored Nov 12, 2024
1 parent cf92349 commit 3168555
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions mm/2s2h/Extractor/Extract.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down

0 comments on commit 3168555

Please sign in to comment.