mirror of
https://github.com/izzy2lost/ppsspp.git
synced 2026-03-10 12:43:04 -07:00
Don't ignore SCE_KERNEL_ERROR_NOCWD in many cases.
Use a error 1 to mean the uccessful mapping but carry with SCE_KERNEL_ERROR_NOCWD error.
This commit is contained in:
@@ -244,7 +244,7 @@ int MetaFileSystem::MapFilePath(const std::string &_inpath, std::string &outpath
|
||||
VERBOSE_LOG(FILESYS, "MapFilePath: mapped \"%s\" to prefix: \"%s\", path: \"%s\"", inpath.c_str(), fileSystems[i].prefix.c_str(), outpath.c_str());
|
||||
|
||||
if (error == SCE_KERNEL_ERROR_NOCWD)
|
||||
return error;
|
||||
return 1; // This means successful mapping but carry with SCE_KERNEL_ERROR_NOCWD error.
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -342,9 +342,9 @@ int MetaFileSystem::OpenFile(std::string filename, FileAccess access, const char
|
||||
std::string of;
|
||||
MountPoint *mount;
|
||||
int error = MapFilePath(filename, of, &mount);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD) {
|
||||
if (error >= 0) {
|
||||
int h = mount->system->OpenFile(of, access, mount->prefix.c_str());
|
||||
if (h < 0 && error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (h < 0 && error == 1)
|
||||
return SCE_KERNEL_ERROR_NOCWD;
|
||||
else
|
||||
return h;
|
||||
@@ -358,7 +358,7 @@ PSPFileInfo MetaFileSystem::GetFileInfo(std::string filename)
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(filename, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
return system->GetFileInfo(of);
|
||||
}
|
||||
@@ -375,7 +375,7 @@ bool MetaFileSystem::GetHostPath(const std::string &inpath, std::string &outpath
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(inpath, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD) {
|
||||
if (error >= 0) {
|
||||
return system->GetHostPath(of, outpath);
|
||||
} else {
|
||||
return false;
|
||||
@@ -388,7 +388,7 @@ std::vector<PSPFileInfo> MetaFileSystem::GetDirListing(std::string path)
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(path, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
return system->GetDirListing(of);
|
||||
}
|
||||
@@ -417,7 +417,7 @@ int MetaFileSystem::ChDir(const std::string &dir)
|
||||
std::string of;
|
||||
MountPoint *mountPoint;
|
||||
int error = MapFilePath(dir, of, &mountPoint);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
currentDir[curThread] = mountPoint->prefix + of;
|
||||
return 0;
|
||||
@@ -447,7 +447,7 @@ bool MetaFileSystem::MkDir(const std::string &dirname)
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(dirname, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
return system->MkDir(of);
|
||||
}
|
||||
@@ -463,7 +463,7 @@ bool MetaFileSystem::RmDir(const std::string &dirname)
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(dirname, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
return system->RmDir(of);
|
||||
}
|
||||
@@ -481,13 +481,13 @@ int MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
|
||||
IFileSystem *osystem;
|
||||
IFileSystem *rsystem = NULL;
|
||||
int error = MapFilePath(from, of, &osystem);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
// If it's a relative path, it seems to always use from's filesystem.
|
||||
if (to.find(":/") != to.npos)
|
||||
{
|
||||
error = MapFilePath(to, rf, &rsystem);
|
||||
if (error != 0)
|
||||
if (error < 0)
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
@@ -513,7 +513,7 @@ bool MetaFileSystem::RemoveFile(const std::string &filename)
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(filename, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
{
|
||||
return system->RemoveFile(of);
|
||||
}
|
||||
@@ -621,7 +621,7 @@ u64 MetaFileSystem::FreeSpace(const std::string &path)
|
||||
std::string of;
|
||||
IFileSystem *system;
|
||||
int error = MapFilePath(path, of, &system);
|
||||
if (error == 0 || error == SCE_KERNEL_ERROR_NOCWD)
|
||||
if (error >= 0)
|
||||
return system->FreeSpace(of);
|
||||
else
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user