diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2020-11-26 08:44:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-26 08:44:59 +0100 |
commit | 7e18fc418ed1dea2cb3ccd42ecbc094146470cf4 (patch) | |
tree | 8241d4ace3925558685c14ec97236dd34afa697f | |
parent | 90832946baf5a36e3362c6774971db2b46ee5b68 (diff) | |
parent | 1c544cd5f3ab78bdb8a083ff5a6493c00739f111 (diff) |
Merge pull request #3371 from Be-ing/fix_new_config
ConfigObject: fix creation of new config file
-rw-r--r-- | src/preferences/configobject.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/preferences/configobject.cpp b/src/preferences/configobject.cpp index 2e25ea076e..74610868cf 100644 --- a/src/preferences/configobject.cpp +++ b/src/preferences/configobject.cpp @@ -237,10 +237,13 @@ bool ConfigObject<ValueType>::save() { } QFile oldConfig(m_filename); - if (!oldConfig.remove()) { - qWarning().nospace() << "Could not remove old config file: " - << oldConfig.fileName() << ": " << oldConfig.errorString(); - return false; + // Trying to remove a file that does not exist would fail + if (oldConfig.exists()) { + if (!oldConfig.remove()) { + qWarning().nospace() << "Could not remove old config file: " + << oldConfig.fileName() << ": " << oldConfig.errorString(); + return false; + } } if (!tmpFile.rename(m_filename)) { qWarning().nospace() << "Could not rename tmp file to config file: " |