From 2e5cfae9043d6236dda88684e7ec8e14bd02ea63 Mon Sep 17 00:00:00 2001 From: probonopd Date: Sun, 19 Feb 2017 13:59:01 +0100 Subject: [PATCH] Do not hardcode usr/ --- shared/shared.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/shared/shared.cpp b/shared/shared.cpp index 3cb3cb6..957efd3 100644 --- a/shared/shared.cpp +++ b/shared/shared.cpp @@ -934,10 +934,11 @@ void deployPlugins(const AppDirInfo &appDirInfo, const QString &pluginSourcePath QString dstResources; QString dstTranslations; if(fhsLikeMode){ - // FIXME - do not hardcode "usr/" but take the directory above the main executable - dstLibexec = appDirInfo.path + "/usr/libexec"; - dstResources = appDirInfo.path + "/usr/resources"; - dstTranslations = appDirInfo.path + "/usr/translations"; + QFileInfo qfi(appDirInfo.binaryPath); + QString qtTargetDir = qfi.absoluteDir().absolutePath() + "/../"; + dstLibexec = qtTargetDir + "/libexec"; + dstResources = qtTargetDir + "/resources"; + dstTranslations = qtTargetDir + "/translations"; } else { dstLibexec = appDirInfo.path + "/libexec"; dstResources = appDirInfo.path + "/resources"; @@ -997,8 +998,9 @@ void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo) QString pluginDestinationPath; if(fhsLikeMode){ - // FIXME - do not hardcode "usr/" but take the directory above the main executable - pluginDestinationPath = appDirPath + "/usr/" + "plugins"; + QFileInfo qfi(applicationBundle.binaryPath); + QString qtTargetDir = qfi.absoluteDir().absolutePath() + "/../"; + pluginDestinationPath = qtTargetDir + "/plugins"; } else { pluginDestinationPath = appDirPath + "/" + "plugins"; } @@ -1007,7 +1009,18 @@ void deployPlugins(const QString &appDirPath, DeploymentInfo deploymentInfo) void deployQmlImport(const QString &appDirPath, const QSet &rpaths, const QString &importSourcePath, const QString &importName) { - QString importDestinationPath = appDirPath + "/qml/" + importName; + AppDirInfo applicationBundle; + applicationBundle.path = appDirPath; + applicationBundle.binaryPath = appBinaryPath; + + QString importDestinationPath; + if(fhsLikeMode){ + QFileInfo qfi(applicationBundle.binaryPath); + QString qtTargetDir = qfi.absoluteDir().absolutePath() + "/../"; + importDestinationPath = qtTargetDir + "/qml/" + importName; + } else { + importDestinationPath = appDirPath + "/qml/" + importName; + } // Skip already deployed imports. This can happen in cases like "QtQuick.Controls.Styles", // where deploying QtQuick.Controls will also deploy the "Styles" sub-import.