From e6b70fdb185518ab148cc4ad0db3ce3f535ff226 Mon Sep 17 00:00:00 2001 From: Julien Marrec Date: Tue, 1 Jun 2021 11:00:24 +0200 Subject: [PATCH] Fix #372 - writeSettings / writeLibraryPaths warn user if settings can't be written to --- src/openstudio_app/OpenStudioApp.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/openstudio_app/OpenStudioApp.cpp b/src/openstudio_app/OpenStudioApp.cpp index 690410f89..83ef31a57 100644 --- a/src/openstudio_app/OpenStudioApp.cpp +++ b/src/openstudio_app/OpenStudioApp.cpp @@ -132,6 +132,7 @@ #include #include #include +#include #include #include @@ -1173,6 +1174,10 @@ void OpenStudioApp::writeSettings() { QString organizationName = QCoreApplication::organizationName(); QString applicationName = QCoreApplication::applicationName(); QSettings settings(organizationName, applicationName); + if (!settings.isWritable()) { + QMessageBox::warning(nullptr, tr("Settings file not writable"), + tr("Your settings file '") + settings.fileName() + tr("' is not writable. Adjust the file permissions")); + } settings.setValue("lastPath", lastPath()); } @@ -1302,6 +1307,11 @@ void OpenStudioApp::writeLibraryPaths(std::vector paths) { QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName()); + if (!settings.isWritable()) { + QMessageBox::warning(nullptr, tr("Settings file not writable"), + tr("Your settings file '") + settings.fileName() + tr("' is not writable. Adjust the file permissions")); + } + if (paths == defaultPaths) { settings.remove("library"); } else {