Use MoveFileExW to implement FioRenameFile on Windows
This is to allow renaming over an existing file
This commit is contained in:
@@ -383,7 +383,7 @@ void FioCreateDirectory(const std::string &name)
|
||||
bool FioRenameFile(const std::string &oldname, const std::string &newname)
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
return _wrename(OTTD2FS(oldname).c_str(), OTTD2FS(newname).c_str()) == 0;
|
||||
return MoveFileExW(OTTD2FS(oldname).c_str(), OTTD2FS(newname).c_str(), MOVEFILE_COPY_ALLOWED | MOVEFILE_REPLACE_EXISTING) != 0;
|
||||
#else
|
||||
return rename(oldname.c_str(), newname.c_str()) == 0;
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user