IOP HLE: Fix broken dopen implementation

This commit is contained in:
Ty Lamontagne 2023-12-31 10:35:47 -05:00 committed by Connor McLaughlin
parent ec12d9b657
commit 2e0988ff03
1 changed files with 4 additions and 2 deletions

View File

@ -403,10 +403,12 @@ namespace R3000A
std::string relativePath = full_path.substr(full_path.find(':') + 1);
std::string path = host_path(relativePath, true);
FileSystem::FindResultsArray results;
if (!FileSystem::FindFiles(path.c_str(), "*", FILESYSTEM_FIND_FILES | FILESYSTEM_FIND_FOLDERS | FILESYSTEM_FIND_RELATIVE_PATHS | FILESYSTEM_FIND_HIDDEN_FILES, &results))
if (!FileSystem::DirectoryExists(path.c_str()))
return -IOP_ENOENT; // Should return ENOTDIR if path is a file?
FileSystem::FindResultsArray results;
FileSystem::FindFiles(path.c_str(), "*", FILESYSTEM_FIND_FILES | FILESYSTEM_FIND_FOLDERS | FILESYSTEM_FIND_RELATIVE_PATHS | FILESYSTEM_FIND_HIDDEN_FILES, &results);
*dir = new HostDir(std::move(results), std::move(path));
if (!*dir)
return -IOP_ENOMEM;