diff options
author | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-05-04 11:49:25 +0200 |
---|---|---|
committer | Joerg Bornemann <joerg.bornemann@theqtcompany.com> | 2015-05-04 12:57:25 +0000 |
commit | 680c31c8ce22959c053ac7881d400d5502f16b78 (patch) | |
tree | 626a6e24eabd22cae4f23163e1187e8952fa260e /src/lib/corelib/api/runenvironment.cpp | |
parent | 9bb5e477ef919ec469d74dd8aa4bb77a2bb2a18e (diff) |
fix usage of QFileInfo when running nodejs
On a Windows machine with Emscripten installed qbs tried to execute
the directory ...\Emscripten\node when trying to run nodejs scripts.
Check for directories when finding executables to fix this.
Change-Id: Icc62d378ffa29c041bd4cabdbaca37550d483cb8
Reviewed-by: Jake Petroules <jake.petroules@petroules.com>
Diffstat (limited to 'src/lib/corelib/api/runenvironment.cpp')
-rw-r--r-- | src/lib/corelib/api/runenvironment.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/corelib/api/runenvironment.cpp b/src/lib/corelib/api/runenvironment.cpp index 59430ce34..120d12c14 100644 --- a/src/lib/corelib/api/runenvironment.cpp +++ b/src/lib/corelib/api/runenvironment.cpp @@ -142,9 +142,11 @@ static QString findExecutable(const QStringList &fileNames) .split(HostOsInfo::pathListSeparator(), QString::SkipEmptyParts); foreach (const QString &fileName, fileNames) { + const QString exeFileName = HostOsInfo::appendExecutableSuffix(fileName); foreach (const QString &ppath, path) { - const QString fullPath = ppath + QLatin1Char('/') + fileName; - if (QFileInfo(fullPath).exists()) + const QString fullPath = ppath + QLatin1Char('/') + exeFileName; + QFileInfo fi(fullPath); + if (fi.exists() && fi.isFile() && fi.isExecutable()) return QDir::cleanPath(fullPath); } } @@ -187,7 +189,8 @@ int RunEnvironment::runTarget(const QString &targetBin, const QStringList &argum // 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()) { + QFileInfo fi(targetExecutable); + if (targetBin == targetExecutable && (!fi.isFile() || !fi.isExecutable())) { d->logger.qbsLog(LoggerError) << Tr::tr("File '%1' is not an executable.") .arg(QDir::toNativeSeparators(targetExecutable)); return EXIT_FAILURE; |