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>
@ -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;