Add "GetFileInfoByHandle" function to (many) file systems

This commit is contained in:
Henrik Rydgård
2025-03-19 10:42:30 +01:00
parent c4241e283a
commit ef386ac4c5
11 changed files with 58 additions and 3 deletions
+9 -1
View File
@@ -162,7 +162,7 @@ static bool RealPath(const std::string &currentDirectory, const std::string &inP
return true;
}
IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle)
IFileSystem *MetaFileSystem::GetHandleOwner(u32 handle) const
{
std::lock_guard<std::recursive_mutex> guard(lock);
for (size_t i = 0; i < fileSystems.size(); i++)
@@ -368,6 +368,14 @@ PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
}
}
PSPFileInfo MetaFileSystem::GetFileInfoByHandle(u32 handle) {
std::lock_guard<std::recursive_mutex> guard(lock);
IFileSystem *sys = GetHandleOwner(handle);
if (sys)
return sys->GetFileInfoByHandle(handle);
return PSPFileInfo();
}
std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(const std::string &path, bool *exists) {
std::lock_guard<std::recursive_mutex> guard(lock);
std::string of;