wrappers: Don't rely on "readlink -f"
Older macOS versions (macOS 12.2 at least) don't support this option, while newer macOS versions do support it (macOS 12.6). The solution is based on https://stackoverflow.com/a/1116890/3115956, but simplified for this usecase.
This commit is contained in:
1 parent
fc5d2c9b21
commit
3184cb2060
3 files changed
+33
-3
No files matched your search
@@ -14,7 +14,17 @@
|
|||||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
DIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd)"
|
get_dir() {
|
||||||
|
target="$1"
|
||||||
|
while [ -L "$target" ]; do
|
||||||
|
cd "$(dirname "$target")"
|
||||||
|
target="$(readlink "$(basename "$target")")"
|
||||||
|
done
|
||||||
|
cd "$(dirname "$target")"
|
||||||
|
pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
DIR="$(get_dir "$0")"
|
||||||
BASENAME="$(basename "$0")"
|
BASENAME="$(basename "$0")"
|
||||||
TARGET="${BASENAME%-*}"
|
TARGET="${BASENAME%-*}"
|
||||||
EXE="${BASENAME##*-}"
|
EXE="${BASENAME##*-}"
|
||||||
|
|||||||
+11
-1
@@ -14,7 +14,17 @@
|
|||||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
DIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd)"
|
get_dir() {
|
||||||
|
target="$1"
|
||||||
|
while [ -L "$target" ]; do
|
||||||
|
cd "$(dirname "$target")"
|
||||||
|
target="$(readlink "$(basename "$target")")"
|
||||||
|
done
|
||||||
|
cd "$(dirname "$target")"
|
||||||
|
pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
DIR="$(get_dir "$0")"
|
||||||
export PATH="$DIR":"$PATH"
|
export PATH="$DIR":"$PATH"
|
||||||
|
|
||||||
BASENAME="$(basename "$0")"
|
BASENAME="$(basename "$0")"
|
||||||
|
|||||||
@@ -14,7 +14,17 @@
|
|||||||
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||||
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
DIR="$(cd "$(dirname $(readlink -f "$0"))" && pwd)"
|
get_dir() {
|
||||||
|
target="$1"
|
||||||
|
while [ -L "$target" ]; do
|
||||||
|
cd "$(dirname "$target")"
|
||||||
|
target="$(readlink "$(basename "$target")")"
|
||||||
|
done
|
||||||
|
cd "$(dirname "$target")"
|
||||||
|
pwd
|
||||||
|
}
|
||||||
|
|
||||||
|
DIR="$(get_dir "$0")"
|
||||||
export PATH="$DIR":"$PATH"
|
export PATH="$DIR":"$PATH"
|
||||||
|
|
||||||
if [ "$1" = "-f" ]; then
|
if [ "$1" = "-f" ]; then
|
||||||
|
|||||||
Reference in new issue
Block a user