What is the difference between launching a Mac OS X app via the Finder/open and executing the app binary directly?

415 Views Asked by At

I'm experiencing an issue with a Qt app on Mac OS X 10.10.5, whereby a QFileDialog will not close properly when canceled. While this may be a bug in Qt, I only see this bug when running the app as a normal user would, e.g. opening it in the Finder (or via command line open). If I launch the app via Xcode or by calling the binary directly, there is no issue.

  1. Launch the app via calling the binary directly on the command line or within Xcode, e.g. ./MyApp.app/Contents/MacOS/MyApp

  2. Launch the app via the Finder or open, e.g. open ./MyApp.app

What are the differences between these two methods - and how does it impact a running application?

1

There are 1 best solutions below

2
Kuba hasn't forgotten Monica On

The major difference is the working folder. You don't have any control over what it is, but it will be different between the two invocations.

What directory are you showing the QFileDialog in? You should probably start in a well-defined place, like the user's home.