Actually check MoveFileEx's return value

This commit is contained in:
Thomas Goyne 2012-10-21 08:08:13 -07:00
parent da79178cc9
commit 715c882a97
1 changed files with 2 additions and 1 deletions

View File

@ -57,7 +57,8 @@ void Rename(const std::string& from, const std::string& 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) {