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

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) {