#5657 Fix serial key file path in GUI

This commit is contained in:
Andrew Nelless 2016-10-13 14:49:53 +01:00
parent 719e64dc8f
commit fd8e778b2a
3 changed files with 14 additions and 6 deletions

View File

@ -22,10 +22,18 @@
#include <QCoreApplication> #include <QCoreApplication>
#include <QProcess> #include <QProcess>
#include <QtGlobal>
#include <QDir>
#include <stdexcept> #include <stdexcept>
static const char kCoreBinary[] = "syntool"; static const char kCoreBinary[] = "syntool";
#ifdef Q_WS_WIN
static const char kSerialKeyFilename[] = "Synergy.subkey";
#else
static const char kSerialKeyFilename[] = ".synergy.subkey";
#endif
CoreInterface::CoreInterface() CoreInterface::CoreInterface()
{ {
} }
@ -54,10 +62,10 @@ QString CoreInterface::getArch()
return run(args); return run(args);
} }
QString CoreInterface::getSubscriptionFilename() QString CoreInterface::getSerialKeyFilePath()
{ {
QStringList args("--get-subscription-filename"); QString filename = getProfileDir() + QDir::separator() + kSerialKeyFilename;
return run(args); return filename;
} }
QString CoreInterface::activateSerial(const QString& serial) QString CoreInterface::activateSerial(const QString& serial)

View File

@ -28,7 +28,7 @@ public:
QString getProfileDir(); QString getProfileDir();
QString getInstalledDir(); QString getInstalledDir();
QString getArch(); QString getArch();
QString getSubscriptionFilename(); QString getSerialKeyFilePath();
QString activateSerial(const QString& serial); QString activateSerial(const QString& serial);
QString checkSubscription(); QString checkSubscription();
QString notifyActivation(const QString& identity); QString notifyActivation(const QString& identity);

View File

@ -85,9 +85,9 @@ bool SubscriptionManager::checkSubscription()
bool SubscriptionManager::fileExists() bool SubscriptionManager::fileExists()
{ {
CoreInterface coreInterface; CoreInterface coreInterface;
QString subscriptionFilename = coreInterface.getSubscriptionFilename(); QString serialKeyFilePath = coreInterface.getSerialKeyFilePath();
return QFile::exists(subscriptionFilename); return QFile::exists(serialKeyFilePath);
} }
void SubscriptionManager::checkError(QString& error) void SubscriptionManager::checkError(QString& error)