diff --git a/linux.cpp b/linux.cpp index 733ae0e..a365c69 100644 --- a/linux.cpp +++ b/linux.cpp @@ -270,10 +270,16 @@ std::string getCertStore() return ""; } +void initApplicationName() +{ + QCoreApplication::setOrganizationName("unvanquished"); + QCoreApplication::setApplicationName("updater"); +} + // Settings are stored in ~/.config/unvanquished/updater.conf QSettings* makePersistentSettings(QObject* parent) { - return new QSettings("unvanquished", "updater", parent); + return new QSettings(parent); } QString getGameCommand(const QString& installPath) diff --git a/main.cpp b/main.cpp index c4970df..7048d2f 100644 --- a/main.cpp +++ b/main.cpp @@ -158,9 +158,8 @@ CommandLineOptions getCommandLineOptions(const QApplication& app) { int main(int argc, char *argv[]) { - QCoreApplication::setApplicationName("Unvanquished Updater"); + Sys::initApplicationName(); QCoreApplication::setApplicationVersion(GIT_VERSION); - QCoreApplication::setOrganizationName("Unvanquished Development"); QCoreApplication::setOrganizationDomain("unvanquished.net"); QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QApplication app(argc, argv); diff --git a/osx.cpp b/osx.cpp index 5895778..a532444 100644 --- a/osx.cpp +++ b/osx.cpp @@ -173,6 +173,12 @@ std::string getCertStore() return ""; // Not used on OSX. } +void initApplicationName() +{ + QCoreApplication::setOrganizationName("Unvanquished Development"); + QCoreApplication::setApplicationName("Unvanquished Updater"); +} + // Settings are stored in "~/Library/Preferences/net.unvanquished.Unvanquished Updater.plist" // After deleting/changing the file, you must run `sudo killall cfprefsd` for it to take effect QSettings* makePersistentSettings(QObject* parent) diff --git a/system.h b/system.h index 53b34f8..195c654 100644 --- a/system.h +++ b/system.h @@ -26,6 +26,7 @@ namespace Sys { QString archiveName(); QString defaultInstallPath(); +void initApplicationName(); // influences default storage location for QSettings bool validateInstallPath(const QString& installPath); // Checks installing as root in homepath on Linux bool installShortcuts(); // Install launch menu entries and protocol handlers bool installUpdater(const QString& installPath); // Copies current application to /updater[.exe|.app] diff --git a/win.cpp b/win.cpp index 4fe8e92..c8dc933 100644 --- a/win.cpp +++ b/win.cpp @@ -295,11 +295,20 @@ std::string getCertStore() return ""; // Not used on Windows. } +void initApplicationName() +{ + QCoreApplication::setOrganizationName("Unvanquished Development"); + QCoreApplication::setApplicationName("Unvanquished Updater"); +} + // Settings are stored in the registry at (on 64-bit Windows) // HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Unvanquished Development\Unvanquished Updater // ≤v0.0.5 used HKEY_CURRENT_USER\Software\Unvanquished Development\Unvanquished Updater +// Note: a class that we use, QQControlsFileDialog, creates some of its own registry entries +// at HKEY_CURRENT_USER\SOFTWARE\Unvanquished Development\Unvanquished Updater QSettings* makePersistentSettings(QObject* parent) { + // We install to Program Files by default, so use global rather than per-user settings. return new QSettings(QSettings::SystemScope, parent); }