mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
Fix two edge cases in path mapping on scoped storage. (#19793)
Fixes #19788
This commit is contained in:
commit
855e00d192
1 changed files with 26 additions and 8 deletions
|
@ -80,20 +80,22 @@ DirectoryFileSystem::~DirectoryFileSystem() {
|
|||
|
||||
// TODO(scoped): Merge the two below functions somehow.
|
||||
|
||||
Path DirectoryFileHandle::GetLocalPath(const Path &basePath, std::string localpath) const {
|
||||
if (localpath.empty())
|
||||
Path DirectoryFileHandle::GetLocalPath(const Path &basePath, std::string localPath) const {
|
||||
if (localPath.empty())
|
||||
return basePath;
|
||||
|
||||
if (localpath[0] == '/')
|
||||
localpath.erase(0, 1);
|
||||
if (localPath[0] == '/')
|
||||
localPath.erase(0, 1);
|
||||
|
||||
if (fileSystemFlags_ & FileSystemFlags::STRIP_PSP) {
|
||||
if (startsWithNoCase(localpath, "PSP/")) {
|
||||
localpath = localpath.substr(4);
|
||||
if (localPath == "PSP") {
|
||||
localPath = "/";
|
||||
} else if (startsWithNoCase(localPath, "PSP/")) {
|
||||
localPath = localPath.substr(4);
|
||||
}
|
||||
}
|
||||
|
||||
return basePath / localpath;
|
||||
return basePath / localPath;
|
||||
}
|
||||
|
||||
Path DirectoryFileSystem::GetLocalPath(std::string internalPath) const {
|
||||
|
@ -104,7 +106,9 @@ Path DirectoryFileSystem::GetLocalPath(std::string internalPath) const {
|
|||
internalPath.erase(0, 1);
|
||||
|
||||
if (flags & FileSystemFlags::STRIP_PSP) {
|
||||
if (startsWithNoCase(internalPath, "PSP/")) {
|
||||
if (internalPath == "PSP") {
|
||||
internalPath = "/";
|
||||
} else if (startsWithNoCase(internalPath, "PSP/")) {
|
||||
internalPath = internalPath.substr(4);
|
||||
}
|
||||
}
|
||||
|
@ -815,6 +819,7 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(const std::string &p
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!success) {
|
||||
if (exists)
|
||||
*exists = false;
|
||||
|
@ -868,6 +873,19 @@ std::vector<PSPFileInfo> DirectoryFileSystem::GetDirListing(const std::string &p
|
|||
myVector.push_back(entry);
|
||||
}
|
||||
|
||||
if (this->flags & FileSystemFlags::STRIP_PSP) {
|
||||
if (path == "/") {
|
||||
// Artificially add the /PSP directory to the root listing.
|
||||
PSPFileInfo pspInfo{};
|
||||
pspInfo.name = "PSP";
|
||||
pspInfo.type = FILETYPE_DIRECTORY;
|
||||
pspInfo.size = 4096;
|
||||
pspInfo.access = 0x777;
|
||||
pspInfo.exists = true;
|
||||
myVector.push_back(pspInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (exists)
|
||||
*exists = true;
|
||||
return ReplayApplyDiskListing(myVector, CoreTiming::GetGlobalTimeUs());
|
||||
|
|
Loading…
Add table
Reference in a new issue