1
0
Fork 0

DBG: don't create backup file for exports

This commit is contained in:
mrexodia 2016-10-08 01:56:29 +02:00
parent 00eaf4b5aa
commit 0210ea5640
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
1 changed files with 4 additions and 3 deletions

View File

@ -40,7 +40,7 @@ void DbSave(DbLoadSaveType saveType, const char* dbfile, bool disablecompression
EXCLUSIVE_ACQUIRE(LockDatabase);
auto file = dbfile ? dbfile : dbpath;
dprintf(QT_TRANSLATE_NOOP("DBG", "Saving database to %s\n"), file);
dprintf(QT_TRANSLATE_NOOP("DBG", "Saving database to %s "), file);
DWORD ticks = GetTickCount();
JSON root = json_object();
@ -105,7 +105,8 @@ void DbSave(DbLoadSaveType saveType, const char* dbfile, bool disablecompression
}
auto wdbpath = StringUtils::Utf8ToUtf16(file);
CopyFileW(wdbpath.c_str(), (wdbpath + L".bak").c_str(), FALSE); //make a backup
if(!dbfile)
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(1));
@ -146,7 +147,7 @@ void DbLoad(DbLoadSaveType loadType, const char* dbfile)
if(loadType == DbLoadSaveType::CommandLine)
dputs(QT_TRANSLATE_NOOP("DBG", "Loading commandline..."));
else
dprintf(QT_TRANSLATE_NOOP("DBG", "Loading database from %s\n"), file);
dprintf(QT_TRANSLATE_NOOP("DBG", "Loading database from %s "), file);
DWORD ticks = GetTickCount();
// Multi-byte (UTF8) file path converted to UTF16