From ad9cfd64af4f8f15623069c3381f78d7db13a734 Mon Sep 17 00:00:00 2001 From: Adam Potolsky Date: Tue, 2 Jun 2015 14:29:01 -0700 Subject: [PATCH] Added symbolic link creation to linux and macos #4696 --- src/gui/src/PluginManager.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/gui/src/PluginManager.cpp b/src/gui/src/PluginManager.cpp index ee6e1011..a30d0056 100644 --- a/src/gui/src/PluginManager.cpp +++ b/src/gui/src/PluginManager.cpp @@ -25,6 +25,8 @@ #include "Fingerprint.h" #include "Plugin.h" +#include + #include #include #include @@ -83,7 +85,8 @@ void PluginManager::copyPlugins() // Get the Directory where plugins are put on installation // If it doesn't exist, there is nothing to do QString srcDirName(m_InstalledDir.append(QDir::separator()) - .append(Plugin::getOsSpecificInstallerLocation())); + .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") @@ -133,9 +141,9 @@ void PluginManager::copyPlugins() } catch (std::exception& e) { - emit error(tr("An error occurred while trying to copy the " - "plugin list. Please contact the help desk, and " - "provide the following details.\n\n%1").arg(e.what())); + emit error(tr( "An error occurred while trying to copy the " + "plugin list. Please contact the help desk, and " + "provide the following details.\n\n%1").arg(e.what())); } emit copyFinished(); return;