Implement vfs::host::rename

With spurious access error workaround
This commit is contained in:
Nekotekina 2019-04-07 12:58:08 +03:00
parent 3354f068fc
commit 9736773c04
5 changed files with 28 additions and 9 deletions

View file

@ -1,5 +1,6 @@
#include "stdafx.h"
#include "IdManager.h"
#include "System.h"
#include "VFS.h"
#include "Utilities/mutex.h"
@ -447,3 +448,17 @@ std::string vfs::unescape(std::string_view path)
return result;
}
bool vfs::host::rename(const std::string& from, const std::string& to, bool overwrite)
{
while (!fs::rename(from, to, overwrite))
{
// Try to ignore access error in order to prevent spurious failure
if (Emu.IsStopped() || fs::g_tls_error != fs::error::acces)
{
return false;
}
}
return true;
}