mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 05:19:56 +00:00
Path browser: Move special handling of Windows root directory to GetFilesInDir.
This commit is contained in:
parent
623cc99145
commit
a0bae1855f
@ -167,6 +167,26 @@ size_t GetFilesInDir(const Path &directory, std::vector<FileInfo> * files, const
|
||||
return true;
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
if (directory.IsRoot()) {
|
||||
// Special path that means root of file system.
|
||||
std::vector<std::string> drives = File::GetWindowsDrives();
|
||||
for (auto drive = drives.begin(); drive != drives.end(); ++drive) {
|
||||
if (*drive == "A:/" || *drive == "B:/")
|
||||
continue;
|
||||
File::FileInfo fake;
|
||||
fake.fullName = Path(*drive);
|
||||
fake.name = *drive;
|
||||
fake.isDirectory = true;
|
||||
fake.exists = true;
|
||||
fake.size = 0;
|
||||
fake.isWritable = false;
|
||||
files->push_back(fake);
|
||||
}
|
||||
return files->size();
|
||||
}
|
||||
#endif
|
||||
|
||||
size_t foundEntries = 0;
|
||||
std::set<std::string> filters;
|
||||
if (filter) {
|
||||
|
@ -214,32 +214,13 @@ bool PathBrowser::GetListing(std::vector<File::FileInfo> &fileInfo, const char *
|
||||
guard.lock();
|
||||
}
|
||||
|
||||
#if PPSSPP_PLATFORM(WINDOWS)
|
||||
if (path_.IsRoot()) {
|
||||
// Special path that means root of file system.
|
||||
std::vector<std::string> drives = File::GetWindowsDrives();
|
||||
for (auto drive = drives.begin(); drive != drives.end(); ++drive) {
|
||||
if (*drive == "A:/" || *drive == "B:/")
|
||||
continue;
|
||||
File::FileInfo fake;
|
||||
fake.fullName = Path(*drive);
|
||||
fake.name = *drive;
|
||||
fake.isDirectory = true;
|
||||
fake.exists = true;
|
||||
fake.size = 0;
|
||||
fake.isWritable = false;
|
||||
fileInfo.push_back(fake);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (path_.Type() == PathType::HTTP) {
|
||||
fileInfo = ApplyFilter(pendingFiles_, filter);
|
||||
return true;
|
||||
} else {
|
||||
File::GetFilesInDir(path_, &fileInfo, filter);
|
||||
return true;
|
||||
}
|
||||
|
||||
File::GetFilesInDir(path_, &fileInfo, filter);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PathBrowser::CanNavigateUp() {
|
||||
|
Loading…
Reference in New Issue
Block a user