forked from mia/Aegisub
Actually check MoveFileEx's return value
This commit is contained in:
parent
b968a7333b
commit
facee0578d
1 changed files with 2 additions and 1 deletions
|
@ -57,7 +57,8 @@ void Rename(const std::string& from, const std::string& to) {
|
||||||
acs::CheckDirWrite(DirName(to));
|
acs::CheckDirWrite(DirName(to));
|
||||||
}
|
}
|
||||||
|
|
||||||
MoveFileEx(ConvertW(from).c_str(), ConvertW(to).c_str(), MOVEFILE_REPLACE_EXISTING);
|
if (!MoveFileEx(ConvertW(from).c_str(), ConvertW(to).c_str(), MOVEFILE_REPLACE_EXISTING))
|
||||||
|
throw agi::FileNotAccessibleError("Can not overwrite file: " + ErrorString(GetLastError()));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ErrorString(DWORD error) {
|
std::string ErrorString(DWORD error) {
|
||||||
|
|
Loading…
Reference in a new issue