summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBe <be@mixxx.org>2020-11-25 18:31:30 -0600
committerBe <be@mixxx.org>2020-11-25 18:31:30 -0600
commit7d6f490efe0b9ebbdedcae06717a41b41163a6bf (patch)
tree59f39cb17244b7045782ebb0d2ff5ce3e046d0c4
parent90832946baf5a36e3362c6774971db2b46ee5b68 (diff)
ConfigObject: fix creation of new config file
-rw-r--r--src/preferences/configobject.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/preferences/configobject.cpp b/src/preferences/configobject.cpp
index 2e25ea076e..fb6b214262 100644
--- a/src/preferences/configobject.cpp
+++ b/src/preferences/configobject.cpp
@@ -237,10 +237,12 @@ 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;
+ 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: "