[Tutorial] Ignore macOS global prefs when detecting existing installs

QSettings with fallbacks enabled reads the global preferences domain on
macOS, so allKeys() returns system keys (AppleLanguages etc.) even on a
fresh install and the tutorial never shows for new Mac users.
This commit is contained in:
Lukas Brübach 2026-10-13 07:16:47 +02:00
parent e4c67f5ea5
commit 178d392361

View file

@ -115,9 +115,13 @@ SettingsCache::SettingsCache()
// Decide once, before any migration writes new files, whether this is an // Decide once, before any migration writes new files, whether this is an
// existing install. Fresh installs have no *.ini files and no legacy // existing install. Fresh installs have no *.ini files and no legacy
// NativeFormat keys; upgrades have one or the other. // NativeFormat keys; upgrades have one or the other. Fallbacks are disabled
// so that on macOS the global preferences domain (AppleLanguages etc.) is
// not mistaken for existing Cockatrice settings on a fresh install.
QSettings legacy;
legacy.setFallbacksEnabled(false);
const bool hadExistingSettings = const bool hadExistingSettings =
!QDir(settingsPath).entryList({"*.ini"}, QDir::Files).isEmpty() || !QSettings().allKeys().isEmpty(); !QDir(settingsPath).entryList({"*.ini"}, QDir::Files).isEmpty() || !legacy.allKeys().isEmpty();
settings = new QSettings(settingsPath + "global.ini", QSettings::IniFormat, this); settings = new QSettings(settingsPath + "global.ini", QSettings::IniFormat, this);