Verify that creating the temp file for saving actually succeeded

This commit is contained in:
Thomas Goyne 2012-10-21 15:21:24 -07:00
parent 715c882a97
commit b43f27396e

View file

@ -78,10 +78,14 @@ Save::Save(const std::string& file, bool binary)
// If the file doesn't exist we create a 0 byte file, this so so
// util::Rename will find it, and to let users know something went
// wrong by leaving a 0 byte file.
std::ofstream fp_touch(ConvertW(file).c_str());
std::ofstream(ConvertW(file).c_str());
}
fp = new std::ofstream(ConvertW(tmp_name).c_str(), binary ? std::ios::binary : std::ios::out);
if (!fp->good()) {
delete fp;
throw agi::FileNotAccessibleError("Could not create temporary file at: " + tmp_name);
}
}
Save::~Save() {