Merge branch '4696' of github.com:synergy/synergy into 4696
This commit is contained in:
commit
d215c49966
|
@ -39,6 +39,12 @@ QString CoreInterface::getProfileDir()
|
|||
return run(args);
|
||||
}
|
||||
|
||||
QString CoreInterface::getInstalledDir()
|
||||
{
|
||||
QStringList args("--get-installed-dir");
|
||||
return run(args);
|
||||
}
|
||||
|
||||
QString CoreInterface::getArch()
|
||||
{
|
||||
QStringList args("--get-arch");
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
|
||||
QString getPluginDir();
|
||||
QString getProfileDir();
|
||||
QString getInstalledDir();
|
||||
QString getArch();
|
||||
QString run(const QStringList& args, const QString& input = "");
|
||||
};
|
||||
|
|
|
@ -33,7 +33,11 @@ void FileSysClient::queryPluginList()
|
|||
QString extension = "*" + Plugin::getOsSpecificExt();
|
||||
QStringList nameFilter(extension);
|
||||
|
||||
QString searchDirectory(Plugin::getOsSpecificInstallerLocation());
|
||||
QString installDir(m_CoreInterface.getInstalledDir()
|
||||
.append(QDir::separator())
|
||||
.append(Plugin::getOsSpecificInstallerLocation()));
|
||||
|
||||
QString searchDirectory(installDir);
|
||||
|
||||
QDir directory(searchDirectory);
|
||||
|
||||
|
|
|
@ -18,16 +18,6 @@
|
|||
#include "Plugin.h"
|
||||
|
||||
#include "CoreInterface.h"
|
||||
//#include "CommandProcess.h"
|
||||
//#include "DataDownloader.h"
|
||||
//#include "QUtility.h"
|
||||
//#include "ProcessorArch.h"
|
||||
//#include "Fingerprint.h"
|
||||
|
||||
//#include <QFile>
|
||||
//#include <QDir>
|
||||
//#include <QProcess>
|
||||
//#include <QCoreApplication>
|
||||
|
||||
static const char kBaseUrl[] = "http://synergy-project.org/files";
|
||||
static const char kDefaultVersion[] = "1.1";
|
||||
|
@ -41,18 +31,15 @@ static const char kLinuxPackagePlatformRpm64[] = "Linux-x86_64-rpm";
|
|||
|
||||
#if defined(Q_OS_WIN)
|
||||
static const char kWinPluginExt[] = ".dll";
|
||||
static const char kInstallerPluginLocation[] = "C:/Program Files/Synergy/Plugins/"; //TODO: needs proper windows %X% notation
|
||||
static const char kUserPluginLocation[] = "C:/Users/speaker/AppData/Local/Synergy/Plugins";//TODO: needs proper windows %X% notation
|
||||
static const char kInstallerPluginLocation[] = "Plugins";
|
||||
#elif defined(Q_OS_MAC)
|
||||
static const char kMacPluginPrefix[] = "lib";
|
||||
static const char kMacPluginExt[] = ".dylib";
|
||||
static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins";
|
||||
static const char kUserPluginLocation[] = "/home/speaker/.synergy/plugins";//TODO: needs proper unix notation
|
||||
static const char kInstallerPluginLocation[] = "plugins";
|
||||
#else
|
||||
static const char kLinuxPluginPrefix[] = "lib";
|
||||
static const char kLinuxPluginExt[] = ".so";
|
||||
static const char kInstallerPluginLocation[] = "/usr/lib/synergy/plugins";
|
||||
static const char kUserPluginLocation[] = "/home/speaker/.synergy/plugins";//TODO: needs proper MacOS X notation
|
||||
static const char kInstallerPluginLocation[] = "plugins";
|
||||
#endif
|
||||
|
||||
QString Plugin::getOsSpecificExt()
|
||||
|
@ -83,8 +70,3 @@ QString Plugin::getOsSpecificName(const QString& pluginName)
|
|||
QString Plugin::getOsSpecificInstallerLocation() {
|
||||
return kInstallerPluginLocation;
|
||||
}
|
||||
|
||||
QString Plugin::getOsSpecificUserLocation() {
|
||||
return kUserPluginLocation;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,11 @@ void PluginManager::initFromFileSys(QStringList pluginList)
|
|||
if (m_ProfileDir.isEmpty()) {
|
||||
emit error(tr("Failed to get profile directory."));
|
||||
}
|
||||
|
||||
m_InstalledDir = m_CoreInterface.getInstalledDir();
|
||||
if (m_InstalledDir.isEmpty()) {
|
||||
emit error(tr("Failed to get installed directory."));
|
||||
}
|
||||
}
|
||||
|
||||
PluginManager::~PluginManager()
|
||||
|
@ -77,7 +82,8 @@ void PluginManager::copyPlugins()
|
|||
try {
|
||||
// Get the Directory where plugins are put on installation
|
||||
// If it doesn't exist, there is nothing to do
|
||||
QString srcDirName = Plugin::getOsSpecificInstallerLocation();
|
||||
QString srcDirName(m_InstalledDir.append(QDir::separator())
|
||||
.append(Plugin::getOsSpecificInstallerLocation()));
|
||||
QDir srcDir(srcDirName);
|
||||
if (!srcDir.exists()) {
|
||||
emit info(
|
||||
|
@ -96,10 +102,10 @@ void PluginManager::copyPlugins()
|
|||
// Run through the list of plugins and copy them
|
||||
for ( int i = 0 ; i < m_FileSysPluginList.size() ; i++ ) {
|
||||
// Get a file entry for the plugin using the full path
|
||||
QFile file(srcDirName + m_FileSysPluginList.at(i));
|
||||
QFile file(srcDirName + QDir::separator() + m_FileSysPluginList.at(i));
|
||||
|
||||
// construct the destination file name
|
||||
QString newName = destDirName;
|
||||
newName.append(QDir::separator()).append(m_FileSysPluginList.at(i));
|
||||
QString newName(destDirName + QDir::separator() + m_FileSysPluginList.at(i));
|
||||
|
||||
// Check to see if the plugin already exists
|
||||
QFile newFile(newName);
|
||||
|
|
|
@ -64,6 +64,7 @@ private:
|
|||
QStringList m_FileSysPluginList;
|
||||
QString m_PluginDir;
|
||||
QString m_ProfileDir;
|
||||
QString m_InstalledDir;
|
||||
CoreInterface m_CoreInterface;
|
||||
SslCertificate m_SslCertificate;
|
||||
};
|
||||
|
|
|
@ -180,6 +180,10 @@ ArgParser::parseToolArgs(ToolArgs& args, int argc, const char* const* argv)
|
|||
args.m_getPluginList = true;
|
||||
return true;
|
||||
}
|
||||
else if (isArg(i, argc, argv, NULL, "--get-installed-dir", 0)) {
|
||||
args.m_getInstalledDir = true;
|
||||
return true;
|
||||
}
|
||||
else if (isArg(i, argc, argv, NULL, "--get-plugin-dir", 0)) {
|
||||
args.m_getPluginDir = true;
|
||||
return true;
|
||||
|
|
|
@ -74,6 +74,9 @@ ToolApp::run(int argc, char** argv)
|
|||
else if (m_args.m_getPluginList) {
|
||||
getPluginList();
|
||||
}
|
||||
else if (m_args.m_getInstalledDir) {
|
||||
std::cout << ARCH->getInstalledDirectory() << std::endl;
|
||||
}
|
||||
else if (m_args.m_getPluginDir) {
|
||||
std::cout << ARCH->getPluginDirectory() << std::endl;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ ToolArgs::ToolArgs() :
|
|||
m_loginAuthenticate(false),
|
||||
m_getPluginList(false),
|
||||
m_getPluginDir(false),
|
||||
m_getInstalledDir(false),
|
||||
m_getProfileDir(false)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -28,6 +28,7 @@ public:
|
|||
bool m_loginAuthenticate;
|
||||
bool m_getPluginList;
|
||||
bool m_getPluginDir;
|
||||
bool m_getInstalledDir;
|
||||
bool m_getProfileDir;
|
||||
bool m_getArch;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue