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 "Fingerprint.h"
#include "Plugin.h" #include "Plugin.h"
#include <QTextStream>
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QProcess> #include <QProcess>
@ -84,6 +86,7 @@ void PluginManager::copyPlugins()
// If it doesn't exist, there is nothing to do // If it doesn't exist, there is nothing to do
QString srcDirName(m_InstalledDir.append(QDir::separator()) QString srcDirName(m_InstalledDir.append(QDir::separator())
.append(Plugin::getOsSpecificInstallerLocation())); .append(Plugin::getOsSpecificInstallerLocation()));
QDir srcDir(srcDirName); QDir srcDir(srcDirName);
if (!srcDir.exists()) { if (!srcDir.exists()) {
emit info( emit info(
@ -95,6 +98,7 @@ void PluginManager::copyPlugins()
// Get the directory where Plugins are installed into Synergy // Get the directory where Plugins are installed into Synergy
// If it doesn't exist make it // If it doesn't exist make it
QString destDirName = m_PluginDir; QString destDirName = m_PluginDir;
QDir destDir(destDirName); QDir destDir(destDirName);
if (!destDir.exists()) { if (!destDir.exists()) {
destDir.mkpath("."); destDir.mkpath(".");
@ -114,7 +118,11 @@ void PluginManager::copyPlugins()
newFile.remove(); newFile.remove();
} }
// make a copy of the plugin in the new location // make a copy of the plugin in the new location
#if defined(Q_OS_WIN)
bool result = file.copy(newName); bool result = file.copy(newName);
#else
bool result = file.link(newName);
#endif
if ( !result ) { if ( !result ) {
emit error( emit error(
tr("Failed to copy plugin '%1' to: %2\n%3") tr("Failed to copy plugin '%1' to: %2\n%3")
@ -133,7 +141,7 @@ void PluginManager::copyPlugins()
} }
catch (std::exception& e) catch (std::exception& e)
{ {
emit error(tr("An error occurred while trying to copy the " emit error(tr( "An error occurred while trying to copy the "
"plugin list. Please contact the help desk, and " "plugin list. Please contact the help desk, and "
"provide the following details.\n\n%1").arg(e.what())); "provide the following details.\n\n%1").arg(e.what()));
} }