forked from mia/Aegisub
Verify that creating the temp file for saving actually succeeded
This commit is contained in:
parent
715c882a97
commit
b43f27396e
1 changed files with 5 additions and 1 deletions
|
@ -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
|
// 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
|
// util::Rename will find it, and to let users know something went
|
||||||
// wrong by leaving a 0 byte file.
|
// 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);
|
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() {
|
Save::~Save() {
|
||||||
|
|
Loading…
Reference in a new issue