Clone
Nathan Strong <nstrong@tripwire.com>
committed
on 29 Jan 19
OSX: don't try to infer Finder invocation
== DETAILS

When an application packaged by Gradle is executed from a user's
home directory, the w… Show more
OSX: don't try to infer Finder invocation

== DETAILS

When an application packaged by Gradle is executed from a user's

home directory, the working directory is unexpectedly changed to the

script directory.

One consequence of this is that relative paths given on the command line

will fail to resolve. Other consequences would vary from one app to the next.

To the best of my knowledge, there's no way to reliably distinguish between

a terminal invocation and a Finder invocation:

- simply assuming "pwd==$HOME -> Finder" is too broad and caused #5978

- "pwd==$HOME and $0 is absolute path" has the same risk of false-positive,

 except now the root cause is even harder to spot

- environment variables are exactly the same, terminal vs Finder

If there's actually a compelling use-case for being able to execute

scripts via Finder, my recommendation is to build a proper Mac OSX

Application bundle (`project_name.app`).

Signed-off-by: Nathan Strong <nstrong@tripwire.com>

Show less

green-master + 254 more