mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-07-25 08:14:45 +02:00
sceIoRename() ignores any path on dest.
Also, change the interface so it can return an error code. Currently not returning perfect error codes but it's better than before.
This commit is contained in:
@@ -374,18 +374,34 @@ bool MetaFileSystem::RmDir(const std::string &dirname)
|
||||
}
|
||||
}
|
||||
|
||||
bool MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
|
||||
int MetaFileSystem::RenameFile(const std::string &from, const std::string &to)
|
||||
{
|
||||
std::string of;
|
||||
std::string rf;
|
||||
IFileSystem *system;
|
||||
if (MapFilePath(from, of, &system) && MapFilePath(to, rf, &system))
|
||||
IFileSystem *osystem;
|
||||
IFileSystem *rsystem = NULL;
|
||||
if (MapFilePath(from, of, &osystem))
|
||||
{
|
||||
return system->RenameFile(of, rf);
|
||||
// If it's a relative path, it seems to always use from's filesystem.
|
||||
if (to.find(':/') != to.npos)
|
||||
{
|
||||
if (!MapFilePath(to, rf, &rsystem))
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
rf = to;
|
||||
rsystem = osystem;
|
||||
}
|
||||
|
||||
if (osystem != rsystem)
|
||||
return SCE_KERNEL_ERROR_XDEV;
|
||||
|
||||
return osystem->RenameFile(of, rf);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user