#6538 Changed System scope path to be OS dependant

This commit is contained in:
Jamie Newbon 2020-03-19 15:35:29 +00:00
parent a2009d0aa0
commit 11eda20378

View file

@ -48,6 +48,7 @@ public:
};
int waitForTray();
QString getSystemSettingPath();
#if defined(Q_OS_MAC)
bool checkMacAssistiveDevices();
@ -88,11 +89,10 @@ int main(int argc, char* argv[])
#ifndef Q_OS_WIN
QApplication::setQuitOnLastWindowClosed(false);
#endif
//Set the path of the system settings to the programs local folder
//as the default system settings path has problems writing without Admin/root permission
//S
QSettings::setPath(QSettings::Format::IniFormat,
QSettings::Scope::SystemScope,
QString("SystemSettings"));
QSettings::Scope::SystemScope,
getSystemSettingPath());
//Config will default to User settings if they exist,
// otherwise it will load System setting and save them to User settings
@ -160,6 +160,26 @@ int waitForTray()
return true;
}
QString getSystemSettingPath()
{
const QString settingFilename("SystemConfig.ini");
QString path;
#if defined(Q_OS_WIN)
// Program file
path = ""
#elif defined(Q_OS_DARWIN)
//Global preferances dir
// Would be nice to use /library, but QT has no elevate system in place
path = "/usr/local/etc/symless/synergy/";
#elif defined(Q_OS_LINUX)
// /usr/local/etc/synergy
path = "/usr/local/etc/symless/synergy/";
#else
assert("OS not supported")
#endif
return path + settingFilename;
}
#if defined(Q_OS_MAC)
bool checkMacAssistiveDevices()
{