sync() after write to avoid losing file data on power off.

This commit is contained in:
Robin Davies
2024-09-01 09:53:32 -04:00
parent abb8a1a53c
commit b8c4fafd3a
21 changed files with 102 additions and 34 deletions
+2 -1
View File
@@ -29,6 +29,7 @@
#include <string.h>
#include <stdexcept>
#include "util.hpp"
#include "ofstream_synced.hpp"
using namespace pipedal;
using namespace pipedal::implementation;
@@ -101,7 +102,7 @@ FileBrowserFilesFeature::FileBrowserFilesFeature()
}
void BrowserFilesVersionInfo::Save(std::filesystem::path &path)
{
std::ofstream f{path};
pipedal::ofstream_synced f{path};
if (!f.is_open())
return;
f << version << std::endl;