summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorJake Petroules <jake.petroules@petroules.com>2013-11-12 13:25:28 -0500
committerJake Petroules <jake.petroules@petroules.com>2013-11-14 15:10:02 +0100
commit2ec37fd26d1c23daa7ca3769d8ca654470f3e109 (patch)
tree37d65030ade5a74ee47cf5803c667d90263176b8 /src/lib
parente91f6b50957c504bd05bba20734c56eb8d6f2f23 (diff)
downloadqbs-2ec37fd26d1c23daa7ca3769d8ca654470f3e109.tar.gz
Make Windows files executable through Wine using the run command.
Change-Id: Ia14593d9a49169685a3e25565264342aa457778e Reviewed-by: Christian Kandeler <christian.kandeler@digia.com>
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/api/runenvironment.cpp28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/lib/api/runenvironment.cpp b/src/lib/api/runenvironment.cpp
index bf7b78283..0b3a8b9bf 100644
--- a/src/lib/api/runenvironment.cpp
+++ b/src/lib/api/runenvironment.cpp
@@ -37,6 +37,7 @@
#include <tools/error.h>
#include <tools/hostosinfo.h>
#include <tools/preferences.h>
+#include <tools/propertyfinder.h>
#include <QDir>
#include <QProcess>
@@ -126,15 +127,32 @@ int RunEnvironment::runShell()
int RunEnvironment::runTarget(const QString &targetBin, const QStringList &arguments)
{
+ const QStringList targetOS = PropertyFinder().propertyValue(
+ d->resolvedProduct->properties->value(),
+ QLatin1String("qbs"),
+ QLatin1String("targetOS")).toStringList();
+
QString targetExecutable = targetBin;
QStringList targetArguments = arguments;
const QString completeSuffix = QFileInfo(targetBin).completeSuffix();
- if (HostOsInfo::isWindowsHost() && completeSuffix == QLatin1String("msi")) {
- targetExecutable = QLatin1String("msiexec");
- targetArguments.prepend(QDir::toNativeSeparators(targetBin));
- targetArguments.prepend(QLatin1String("/package"));
- } else if (!QFileInfo(targetExecutable).isExecutable()) {
+ if (targetOS.contains(QLatin1String("windows"))) {
+ if (completeSuffix == QLatin1String("msi")) {
+ targetExecutable = QLatin1String("msiexec");
+ targetArguments.prepend(QDir::toNativeSeparators(targetBin));
+ targetArguments.prepend(QLatin1String("/package"));
+ }
+
+ // Run Windows executables through Wine when not on Windows
+ if (!HostOsInfo::isWindowsHost()) {
+ targetArguments.prepend(targetExecutable);
+ targetExecutable = QLatin1String("wine");
+ }
+ }
+
+ // Only check if the target is executable if we're not running it through another
+ // known application such as msiexec or wine, as we can't check in this case anyways
+ if (targetBin == targetExecutable && !QFileInfo(targetExecutable).isExecutable()) {
d->logger.qbsLog(LoggerError) << Tr::tr("File '%1' is not an executable.")
.arg(QDir::toNativeSeparators(targetExecutable));
return EXIT_FAILURE;