Read QET_SETTINGS_DIR/QElectroTech/ on macOS too (#1246)

On macOS, Qt names the settings subfolder after the organization domain
when one is set, so QElectroTech read <folder>/qelectrotech.org/ while
main.cpp, tst_settingsdir and qet_mcp.py all use <folder>/QElectroTech/.
Clear the domain when QET_SETTINGS_DIR is set, on macOS only. Nothing in
QElectroTech reads it; SingleApplication hashes it into its key, so these
runs no longer hand off to an open QElectroTech.

test_qet_mcp.py: find true on PATH (/usr/bin/true on macOS), and compare
the found binary with samefile() on case-insensitive file systems.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ispyisail
2026-10-03 07:30:07 +13:00
parent 25084a44da
commit 76cad625af
2 changed files with 16 additions and 5 deletions
+6
View File
@@ -112,6 +112,12 @@ int main(int argc, char **argv)
// system (issue #1178). Set before anything reads a setting.
const QString settings_dir = qEnvironmentVariable("QET_SETTINGS_DIR");
if (!settings_dir.isEmpty()) {
#ifdef Q_OS_DARWIN
// On macOS, Qt names that subfolder after the organization domain
// when there is one (<folder>/qelectrotech.org/) (issue #1246).
// Nothing in QElectroTech reads the domain.
QCoreApplication::setOrganizationDomain(QString());
#endif
QSettings::setDefaultFormat(QSettings::IniFormat);
QSettings::setPath(QSettings::IniFormat, QSettings::UserScope, settings_dir);
QSettings::setPath(QSettings::IniFormat, QSettings::SystemScope, settings_dir);