Added symbolic link creation to linux and macos #4696

This commit is contained in:
Adam Potolsky 2015-06-02 14:29:01 -07:00
parent 0061969cf2
commit ad9cfd64af
1 changed files with 12 additions and 4 deletions

View File

@ -25,6 +25,8 @@
#include "Fingerprint.h"
#include "Plugin.h"
#include <QTextStream>
#include <QFile>
#include <QDir>
#include <QProcess>
@ -84,6 +86,7 @@ void PluginManager::copyPlugins()
// If it doesn't exist, there is nothing to do
QString srcDirName(m_InstalledDir.append(QDir::separator())
.append(Plugin::getOsSpecificInstallerLocation()));
QDir srcDir(srcDirName);
if (!srcDir.exists()) {
emit info(
@ -95,6 +98,7 @@ void PluginManager::copyPlugins()
// Get the directory where Plugins are installed into Synergy
// If it doesn't exist make it
QString destDirName = m_PluginDir;
QDir destDir(destDirName);
if (!destDir.exists()) {
destDir.mkpath(".");
@ -114,7 +118,11 @@ void PluginManager::copyPlugins()
newFile.remove();
}
// make a copy of the plugin in the new location
#if defined(Q_OS_WIN)
bool result = file.copy(newName);
#else
bool result = file.link(newName);
#endif
if ( !result ) {
emit error(
tr("Failed to copy plugin '%1' to: %2\n%3")