diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 13:15:38 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2015-12-18 13:15:38 +0000 |
commit | d44cd5334a97f30a50295c385f855d751c187b9e (patch) | |
tree | 45f29d64ba376138c1095b5c64d9c2481d92d801 /src/corelib/io/qprocess_unix.cpp | |
parent | 8b1eb5f4202fb4120a303cd2183bb96f212c5a32 (diff) | |
parent | beb65dcd79f8c354dab7bb4a8d08157bd9d69329 (diff) |
Merge "Merge remote-tracking branch 'origin/5.6' into dev" into refs/staging/dev
Diffstat (limited to 'src/corelib/io/qprocess_unix.cpp')
-rw-r--r-- | src/corelib/io/qprocess_unix.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 9a25f56c5f..ab5734a298 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -92,6 +92,7 @@ QT_END_NAMESPACE #include <private/qthread_p.h> #include <qfile.h> #include <qfileinfo.h> +#include <qdir.h> #include <qlist.h> #include <qmutex.h> #include <qsemaphore.h> @@ -362,11 +363,14 @@ void QProcessPrivate::startProcess() static QBasicMutex cfbundleMutex; QMutexLocker lock(&cfbundleMutex); QCFType<CFBundleRef> bundle = CFBundleCreate(0, url); - url = CFBundleCopyExecutableURL(bundle); + // 'executableURL' can be either relative or absolute ... + QCFType<CFURLRef> executableURL = CFBundleCopyExecutableURL(bundle); + // not to depend on caching - make sure it's always absolute. + url = CFURLCopyAbsoluteURL(executableURL); } if (url) { - QCFString str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); - encodedProgramName += "/Contents/MacOS/" + QCFString::toQString(str).toUtf8(); + const QCFString str = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle); + encodedProgramName += (QDir::separator() + QDir(program).relativeFilePath(QCFString::toQString(str))).toUtf8(); } } #endif |