Migrate destructive calls of File::CopyDir() to File::Move().

This commit is contained in:
Admiral H. Curtiss 2023-02-24 21:48:01 +01:00
parent 5367bf394c
commit 4f462b4ef6
No known key found for this signature in database
GPG Key ID: F051B4C4044F33FB
2 changed files with 7 additions and 4 deletions

View File

@ -121,7 +121,7 @@ void WFSIDevice::FinalizePatchInstall()
const std::string current_title_dir = fmt::format("/vol/{}/title/{}/{}", m_device_name,
m_current_group_id_str, m_current_title_id_str);
const std::string patch_dir = current_title_dir + "/_patch";
File::CopyDir(WFS::NativePath(patch_dir), WFS::NativePath(current_title_dir), true);
File::MoveWithOverwrite(WFS::NativePath(patch_dir), WFS::NativePath(current_title_dir));
}
std::optional<IPCReply> WFSIDevice::IOCtl(const IOCtlRequest& request)

View File

@ -197,7 +197,7 @@ static void MoveToBackupIfExists(const std::string& path)
{
if (File::Exists(path))
{
const std::string backup_path = path.substr(0, path.size() - 1) + ".backup" DIR_SEP;
const std::string backup_path = path.substr(0, path.size() - 1) + ".backup";
WARN_LOG_FMT(IOS_FS, "Temporary directory at {} exists, moving to backup...", path);
// If backup exists, delete it as we don't want a mess
@ -207,7 +207,7 @@ static void MoveToBackupIfExists(const std::string& path)
File::DeleteDirRecursively(backup_path);
}
File::CopyDir(path, backup_path, true);
File::MoveWithOverwrite(path, backup_path);
}
}
@ -399,7 +399,10 @@ void CleanUpWiiFileSystemContents(const BootSessionData& boot_session_data)
// copy back the temp nand redirected files to where they should normally be redirected to
for (const auto& redirect : s_temp_nand_redirects)
File::CopyDir(redirect.temp_path, redirect.real_path + "/", true);
{
File::CreateFullPath(redirect.real_path);
File::MoveWithOverwrite(redirect.temp_path, redirect.real_path);
}
IOS::HLE::EmulationKernel* ios = IOS::HLE::GetIOS();