From 6f9d983e03ee866c6e94c802875111fe8f238dbb Mon Sep 17 00:00:00 2001 From: vslg Date: Sat, 5 Sep 2020 15:02:13 -0300 Subject: [PATCH] Use `settingsFolder` instead of `configDir` --- src/gui/Window.qml | 4 ++-- src/main.cpp | 14 +++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/gui/Window.qml b/src/gui/Window.qml index ac7e9d26..7b8fac10 100644 --- a/src/gui/Window.qml +++ b/src/gui/Window.qml @@ -22,7 +22,7 @@ ApplicationWindow { property var uiState: ({}) property var history: ({}) property var theme: null - property string configDir + property string settingsFolder readonly property var visibleMenus: ({}) readonly property var visiblePopups: ({}) @@ -114,6 +114,6 @@ ApplicationWindow { HTrayIcon { window: window - settingsFolder: configDir + settingsFolder: settingsFolder } } diff --git a/src/main.cpp b/src/main.cpp index 12edee29..a05dc479 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -95,14 +95,14 @@ void onExitSignal(int signum) { bool setLockFile(QString configPath) { - QDir configDir(configPath); + QDir settingsFolder(configPath); - if (! configDir.mkpath(".")) { + if (! settingsFolder.mkpath(".")) { qFatal("Could not create config file."); exit(EXIT_FAILURE); } - lockFile = new QLockFile(configDir.absoluteFilePath(".lock")); + lockFile = new QLockFile(settingsFolder.absoluteFilePath(".lock")); lockFile->tryLock(0); switch (lockFile->error()) { @@ -111,7 +111,7 @@ bool setLockFile(QString configPath) { } case QLockFile::LockFailedError: { qWarning("Opening already running Mirage instance."); - QFile showFile(configDir.absoluteFilePath(".show")); + QFile showFile(settingsFolder.absoluteFilePath(".show")); showFile.open(QIODevice::WriteOnly); showFile.close(); return false; @@ -135,14 +135,14 @@ int main(int argc, char *argv[]) { QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QString customConfigDir(qEnvironmentVariable("MIRAGE_CONFIG_DIR")); - QString configDir( + QString settingsFolder( customConfigDir.isEmpty() ? QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation) + "/" + QCoreApplication::applicationName() : customConfigDir ); - if (! setLockFile(configDir)) return EXIT_SUCCESS; + if (! setLockFile(settingsFolder)) return EXIT_SUCCESS; QApplication app(argc, argv); // Register handlers for quit signals, e.g. SIGINT/Ctrl-C in unix terminals @@ -246,7 +246,7 @@ int main(int argc, char *argv[]) { app.exit(EXIT_FAILURE); } - component.create(objectContext)->setProperty("configDir", configDir); + component.create(objectContext)->setProperty("settingsFolder", settingsFolder); // Finally, execute the app. Return its exit code after clearing the lock. int exit_code = app.exec();