forked from Green-Sky/tomato
make sure file is written before we check it's state
This commit is contained in:
@@ -227,6 +227,8 @@ void ToxClient::saveToxProfile(void) {
|
|||||||
try {
|
try {
|
||||||
std::ofstream ofile{tmp_path, std::ios::binary};
|
std::ofstream ofile{tmp_path, std::ios::binary};
|
||||||
ofile.write(reinterpret_cast<const char*>(data.data()), data.size());
|
ofile.write(reinterpret_cast<const char*>(data.data()), data.size());
|
||||||
|
ofile.flush();
|
||||||
|
|
||||||
if (!ofile.good()) {
|
if (!ofile.good()) {
|
||||||
// TODO: maybe enable fstream exceptions instead?
|
// TODO: maybe enable fstream exceptions instead?
|
||||||
throw std::runtime_error("write error");
|
throw std::runtime_error("write error");
|
||||||
|
Reference in New Issue
Block a user