Skip to content

Commit

Permalink
Fix #372 - writeSettings / writeLibraryPaths warn user if settings ca…
Browse files Browse the repository at this point in the history
…n't be written to
  • Loading branch information
jmarrec committed Jun 1, 2021
1 parent 1c7338d commit e6b70fd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/openstudio_app/OpenStudioApp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@
#include <QTcpServer>
#include <QtConcurrent>
#include <QtGlobal>
#include <QSettings>

#include <openstudio/OpenStudio.hxx>
#include <openstudio/utilities/idd/IddEnums.hxx>
Expand Down Expand Up @@ -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());
}

Expand Down Expand Up @@ -1302,6 +1307,11 @@ void OpenStudioApp::writeLibraryPaths(std::vector<openstudio::path> 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 {
Expand Down

0 comments on commit e6b70fd

Please sign in to comment.