Skip to content

Commit

Permalink
Error message if writing save failed
Browse files Browse the repository at this point in the history
  • Loading branch information
Xadhoom committed Mar 18, 2019
1 parent c452c5d commit d88215f
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions SourceX/miniwin/misc_io.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,15 +129,19 @@ WINBOOL CloseHandle(HANDLE hObject)
return true;
std::unique_ptr<memfile> ufile(file); // ensure that delete file is
// called on returning
bool ret = true;
std::ofstream filestream(file->path + ".tmp", std::ios::binary);
if (filestream.fail())
return false;
ret = false;
filestream.write(file->buf.data(), file->buf.size());
if(filestream.fail())
return false;
if(std::rename((file->path + ".tmp").c_str(), file->path.c_str()))
return false;
return true;
if (filestream.fail())
ret = false;
if (std::rename((file->path + ".tmp").c_str(), file->path.c_str()))
ret = false;
if(!ret) {
DialogBoxParam(ghInst, DVL_MAKEINTRESOURCE(IDD_DIALOG7), ghMainWnd, (DLGPROC)FuncDlg, (LPARAM)file->path.c_str());
}
return ret;
}

} // namespace dvl

0 comments on commit d88215f

Please sign in to comment.