SysConf: Fix writing a new SYSCONF

On Windows, File::GetTempFilenameForAtomicWrite returns a path
somewhere in C:\Users\XXX\AppData\Local\Temp\{UUID here}\
in which all writes just fail.

Just use the SYSCONF path + ".tmp" for the temporary file name.
This commit is contained in:
Léo Lam 2017-07-31 15:18:43 +08:00
parent 141fb0f03c
commit b5e7c417ff
1 changed files with 1 additions and 1 deletions

View File

@ -197,7 +197,7 @@ bool SysConf::Save() const
std::copy(footer.cbegin(), footer.cend(), buffer.end() - footer.size()); std::copy(footer.cbegin(), footer.cend(), buffer.end() - footer.size());
// Write the new data. // Write the new data.
const std::string temp_file = File::GetTempFilenameForAtomicWrite(m_file_name); const std::string temp_file = m_file_name + ".tmp";
File::CreateFullPath(temp_file); File::CreateFullPath(temp_file);
{ {
File::IOFile file(temp_file, "wb"); File::IOFile file(temp_file, "wb");