Skip to content

Commit 9688f5b

Browse files
committed
Add polyfill for realpath (not available on macOS per default)
1 parent bac0f15 commit 9688f5b

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

Classes/Composer/InstallerScripts.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@ class InstallerScripts
1313
private const PRUNNER_DISPATCH_SCRIPT = <<<'EOD'
1414
#!/bin/sh
1515
16+
# Polyfill for realpath which is not available on macOS per default (see https://stackoverflow.com/a/18443300)
17+
realpath() {
18+
OURPWD=$PWD
19+
cd "$(dirname "$1")"
20+
LINK=$(readlink "$(basename "$1")")
21+
while [ "$LINK" ]; do
22+
cd "$(dirname "$LINK")"
23+
LINK=$(readlink "$(basename "$1")")
24+
done
25+
REALPATH="$PWD/$(basename "$1")"
26+
cd "$OURPWD"
27+
echo "$REALPATH"
28+
}
29+
1630
SCRIPTS_DIR=$(dirname "$(realpath $0)")
1731
1832
OS_TYPE=$(uname -s)

0 commit comments

Comments
 (0)