diff options
| author | comex <comexk@gmail.com> | 2013-10-15 02:52:06 -0400 |
|---|---|---|
| committer | comex <comexk@gmail.com> | 2013-10-15 02:59:25 -0400 |
| commit | 72c1e143f351bc9a3c8d7e6cb07d20b0bab58557 (patch) | |
| tree | 9caf292cff9569a705ff96f29825c1e61def561a /Source/Core/Common/Src/IniFile.cpp | |
| parent | f3af8ee0f0da76819321b034cc114bb6852468ac (diff) | |
Try to atomically save config files.
Diffstat (limited to 'Source/Core/Common/Src/IniFile.cpp')
| -rw-r--r-- | Source/Core/Common/Src/IniFile.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Source/Core/Common/Src/IniFile.cpp b/Source/Core/Common/Src/IniFile.cpp index a86e101b01..fbce8254e3 100644 --- a/Source/Core/Common/Src/IniFile.cpp +++ b/Source/Core/Common/Src/IniFile.cpp @@ -391,7 +391,8 @@ bool IniFile::Load(const char* filename, bool keep_current_data) bool IniFile::Save(const char* filename) { std::ofstream out; - OpenFStream(out, filename, std::ios::out); + std::string temp = File::GetTempFilenameForAtomicWrite(filename); + OpenFStream(out, temp, std::ios::out); if (out.fail()) { @@ -425,7 +426,7 @@ bool IniFile::Save(const char* filename) out.close(); - return true; + return File::RenameSync(temp, filename); } |
