1
0
Fork 0

DBG: workaround for issue #551 (backup databases before attempting to write them)

This commit is contained in:
mrexodia 2016-02-25 02:22:37 +01:00
parent b4c6c09faf
commit ea39c7ba48
1 changed files with 4 additions and 4 deletions

View File

@ -61,7 +61,8 @@ void DbSave(DbLoadSaveType saveType)
}
}
WString wdbpath = StringUtils::Utf8ToUtf16(dbpath);
auto wdbpath = StringUtils::Utf8ToUtf16(dbpath);
CopyFileW(wdbpath.c_str(), (wdbpath + L".bak").c_str(), FALSE); //make a backup
if(json_object_size(root))
{
char* jsonText = json_dumps(root, JSON_INDENT(4));
@ -83,9 +84,8 @@ void DbSave(DbLoadSaveType saveType)
if(!settingboolget("Engine", "DisableDatabaseCompression"))
LZ4_compress_fileW(wdbpath.c_str(), wdbpath.c_str());
}
// TODO: Remove if this is the cause of bug #551
//else //remove database when nothing is in there
// DeleteFileW(wdbpath.c_str());
else //remove database when nothing is in there
DeleteFileW(wdbpath.c_str());
dprintf("%ums\n", GetTickCount() - ticks);
json_decref(root); //free root