Fixed: Plugins dir may change depending on user #4168

This commit is contained in:
Nick Bolton
2015-03-04 11:15:07 +00:00
parent c5ed03a8a0
commit cfd21216cd
11 changed files with 132 additions and 12 deletions

View File

@@ -450,6 +450,8 @@ void MainWindow::startSynergy()
args << "--enable-crypto";
}
args << "--profile-dir" << getProfileDirectoryForArg();
if ((synergyType() == synergyClient && !clientArgs(args, app))
|| (synergyType() == synergyServer && !serverArgs(args, app)))
{
@@ -473,6 +475,8 @@ void MainWindow::startSynergy()
appendLogNote("starting " + QString(synergyType() == synergyServer ? "server" : "client"));
qDebug() << args;
// show command if debug log level...
if (appConfig().logLevel() >= 4) {
appendLogNote(QString("command: %1 %2").arg(app, args.join(" ")));
@@ -1216,3 +1220,29 @@ void MainWindow::bonjourInstallFinished()
m_pCheckBoxAutoConfig->setChecked(true);
}
QString MainWindow::getProfileDirectory()
{
#if defined(Q_OS_WIN)
QString qtDataDir = QDesktopServices::storageLocation(
QDesktopServices::DataLocation);
// HACK: core wants the base app data dir, this seems like a very hacky
// way to get it (maybe consider using %LOCALAPPDATA% instead?)
return qtDataDir.replace("\\Synergy\\Synergy", "");
#else
// HACK: this seems hacky, since we're using a hidden folder inside the
// user's home dir to store plugins, etc... but we call it profile dir?
return QDesktopServices::storageLocation(
QDesktopServices::HomeLocation);
#endif
}
QString MainWindow::getProfileDirectoryForArg()
{
return QString("\"%1\"").arg(getProfileDirectory());
}

View File

@@ -165,6 +165,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
void downloadBonjour();
void promptAutoConfig();
void updateEdition();
QString getProfileDirectory();
QString getProfileDirectoryForArg();
private:
QSettings& m_Settings;