mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 08:14:45 +02:00
Io: Provide directory existence with listing.
Sometimes, you need to tell the difference between an empty directory and one that doesn't exist at all. We can do this in a single call.
This commit is contained in:
@@ -369,19 +369,17 @@ PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(std::string path)
|
||||
{
|
||||
std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(const std::string &path, bool *exists) {
|
||||
std::lock_guard<std::recursive_mutex> guard(lock);
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(path, of, &system);
|
||||
if (error == 0)
|
||||
{
|
||||
return system->GetDirListing(of);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (error == 0) {
|
||||
return system->GetDirListing(of, exists);
|
||||
} else {
|
||||
std::vector<PSPFileInfo> empty;
|
||||
if (exists)
|
||||
*exists = false;
|
||||
return empty;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user