Browse Source

Correctly remove incomplete settings file

PR #17362.
adaptive-webui-19844
Chocobo1 2 years ago committed by GitHub
parent
commit
d2a29c2f87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      src/base/settingsstorage.cpp

5
src/base/settingsstorage.cpp

@ -188,10 +188,13 @@ bool SettingsStorage::writeNativeSettings() const
break; break;
} }
const Path newPath {nativeSettings->fileName()};
if (nativeSettings->status() != QSettings::NoError) if (nativeSettings->status() != QSettings::NoError)
{
Utils::Fs::removeFile(newPath);
return false; return false;
}
const Path newPath {nativeSettings->fileName()};
QString finalPathStr = newPath.data(); QString finalPathStr = newPath.data();
const int index = finalPathStr.lastIndexOf(u"_new", -1, Qt::CaseInsensitive); const int index = finalPathStr.lastIndexOf(u"_new", -1, Qt::CaseInsensitive);
finalPathStr.remove(index, 4); finalPathStr.remove(index, 4);

Loading…
Cancel
Save