Workaround for the /PSP path thing. Needs testing.

This commit is contained in:
Henrik Rydgård
2021-07-24 18:16:12 +02:00
parent ab69b896c3
commit 8ab627d6e9
8 changed files with 70 additions and 37 deletions

View File

@@ -177,17 +177,40 @@ DirectoryFileSystem::~DirectoryFileSystem() {
CloseAll();
}
Path DirectoryFileHandle::GetLocalPath(const Path &basePath, std::string localpath)
{
// TODO(scoped): Merge the two below functions somehow.
Path DirectoryFileHandle::GetLocalPath(const Path &basePath, std::string localpath) const {
if (localpath.empty())
return basePath;
if (localpath[0] == '/')
localpath.erase(0, 1);
if (fileSystemFlags_ & FileSystemFlags::STRIP_PSP) {
if (startsWith(localpath, "/PSP")) {
localpath = localpath.substr(4);
}
}
return basePath / localpath;
}
Path DirectoryFileSystem::GetLocalPath(std::string internalPath) const {
if (internalPath.empty())
return basePath;
if (internalPath[0] == '/')
internalPath.erase(0, 1);
if (flags & FileSystemFlags::STRIP_PSP) {
if (startsWith(internalPath, "/PSP")) {
internalPath = internalPath.substr(4);
}
}
return basePath / internalPath;
}
bool DirectoryFileHandle::Open(const Path &basePath, std::string &fileName, FileAccess access, u32 &error) {
error = 0;
@@ -508,16 +531,6 @@ void DirectoryFileSystem::CloseAll() {
entries.clear();
}
Path DirectoryFileSystem::GetLocalPath(std::string internalPath) {
if (internalPath.empty())
return basePath;
if (internalPath[0] == '/')
internalPath.erase(0, 1);
return basePath / internalPath;
}
bool DirectoryFileSystem::MkDir(const std::string &dirname) {
bool result;
#if HOST_IS_CASE_SENSITIVE