forked from Brewtarget/brewtarget
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Brewtarget#680 from matty0ung/release3.0.1
Improved logging of start-up problems. Attempt to fix Mac builds. (They should at least be less broken now!)
- Loading branch information
Showing
28 changed files
with
456 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
/** | ||
* PersistentSettings.cpp is part of Brewtarget, and is copyright the following | ||
* authors 2009-2021: | ||
* authors 2009-2022: | ||
* • A.J. Drobnich <[email protected]> | ||
* • Brian Rower <[email protected]> | ||
* • Chris Pavetto <[email protected]> | ||
|
@@ -36,6 +36,9 @@ | |
*/ | ||
#include "PersistentSettings.h" | ||
|
||
#include <memory> | ||
|
||
#include <QDebug> | ||
#include <QSettings> | ||
#include <QStandardPaths> | ||
|
||
|
@@ -89,11 +92,11 @@ namespace { | |
// | ||
// This is set by PersistentSettings::initialise() | ||
// | ||
QSettings * qSettings = nullptr; | ||
std::unique_ptr<QSettings> qSettings{nullptr}; | ||
|
||
// These also get set by PersistentSettings::initialise() | ||
QDir configDir; | ||
QDir userDataDir; | ||
QDir configDir{""}; | ||
QDir userDataDir{""}; | ||
|
||
} | ||
|
||
|
@@ -112,11 +115,24 @@ void PersistentSettings::initialise(QString customUserDataDir) { | |
// Pretty sure this needs to be done after calls to QApplication::setOrganizationName() etc in main(), which is why | ||
// we don't just use static initialisation. | ||
// | ||
// Yes, we are knowingly logging before Logging::initializeLogging() has been called (as the latter needs | ||
// PersistentSettings::initialise() to be called first. This is OK as it just means the log message will go to the | ||
// default Qt-0determined location (eg stderr on Linux). | ||
// | ||
// The value in this logging is that we have seen instances where the software is unable to determine a value for | ||
// configDir, and we would like to diagnose why (eg whether it is some permissions problem). | ||
// | ||
qInfo() << | ||
Q_FUNC_INFO << "Qt-proposed directories for user-specific configuration files are:" << | ||
QStandardPaths::standardLocations(QStandardPaths::AppConfigLocation); | ||
configDir.setPath(QStandardPaths::writableLocation(QStandardPaths::AppConfigLocation)); | ||
qInfo() << | ||
Q_FUNC_INFO << "Preferred writeable directory for user-specific configuration files is:" << | ||
configDir.absolutePath(); | ||
|
||
// Now we can set the full path of the persistent settings file | ||
qSettings = new QSettings{configDir.absoluteFilePath("brewtarget.conf"), | ||
QSettings::IniFormat}; | ||
qSettings = std::make_unique<QSettings>(configDir.absoluteFilePath("brewkenPersistentSettings.conf"), | ||
QSettings::IniFormat); | ||
|
||
// We've done enough now for calls to contains()/insert()/value() etc to work. Mark that we're initialised so we | ||
// can (potentially) use one of those calls to initialise the user data directory. | ||
|
Oops, something went wrong.