Skip to content

Commit

Permalink
Fix removing old commands config file backup
Browse files Browse the repository at this point in the history
  • Loading branch information
hluk committed Oct 30, 2021
1 parent b288391 commit 736ab31
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/app/clipboardserver.cpp
Expand Up @@ -103,7 +103,7 @@ void migrateCommands(const QString &commandConfigPath)
Settings oldSettings;
const auto oldCommands = loadCommands(&oldSettings.constSettingsData());

const QString commandConfigPathNew = commandConfigPath + ".new";
const QString commandConfigPathNew = commandConfigPath + QStringLiteral(".new");
{
Settings newSettings(commandConfigPathNew);
saveCommands(oldCommands, newSettings.settingsData());
Expand Down Expand Up @@ -134,10 +134,14 @@ void restoreConfiguration()
Settings().restore();

const QString commandConfigPath = getConfigurationFilePath("-commands.ini");
if ( QFile::exists(commandConfigPath) )
if ( QFile::exists(commandConfigPath) ) {
const QString staleCommandConfigPathBakup =
commandConfigPath + QStringLiteral(".new.bak");
QFile::remove(staleCommandConfigPathBakup);
Settings(commandConfigPath).restore();
else
} else {
migrateCommands(commandConfigPath);
}
}

} // namespace
Expand Down

0 comments on commit 736ab31

Please sign in to comment.