summaryrefslogtreecommitdiffstats
path: root/src/qtchooser/main.cpp
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2013-03-22 13:53:55 +0100
committerThiago Macieira <thiago.macieira@intel.com>2013-03-28 19:17:23 +0100
commitad7ec8f6be5bf3c9854168d6c2605fa07cacfc85 (patch)
treecdb084c93a75a1a6919e18088d98d70dc6982540 /src/qtchooser/main.cpp
parent8ceb9e1368326b7ff7faf70f4700223d3cb23c19 (diff)
Can find and launch an app bundle on Mac
Required for https://codereview.qt-project.org/#change,51502 If qml is an app bundle, we'd still like to be able to launch it just as easily on the command line. Change-Id: I37973b296b1da9d27e7f3bfff1c54487bbb387ea Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com> Reviewed-by: Alan Alpert <aalpert@blackberry.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/qtchooser/main.cpp')
-rw-r--r--src/qtchooser/main.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qtchooser/main.cpp b/src/qtchooser/main.cpp
index 7208e98..f559bab 100644
--- a/src/qtchooser/main.cpp
+++ b/src/qtchooser/main.cpp
@@ -221,6 +221,15 @@ int ToolWrapper::runTool(const string &targetSdk, const string &targetTool, char
return 0;
#else
execv(argv[0], argv);
+#ifdef __APPLE__
+ // failed; see if we have a .app package by the same name
+ {
+ char appPath[PATH_MAX];
+ snprintf(appPath, PATH_MAX, "%s.app/Contents/MacOS/%s",
+ argv[0], basename(argv[0]));
+ execv(appPath, argv);
+ }
+#endif
fprintf(stderr, "%s: could not exec '%s': %s\n",
argv0, argv[0], strerror(errno));
return 1;