Make x capable of resolving symlinks
When bootstrapping from outside of the rust source, instead of calling 'x' from the absolute path (like /home/user/rust/x), we should be able to link 'x' from the rust source to binary paths so it can be used easily. Before this change, 'x' was not capable of finding 'x.py' when called from the linked file. Signed-off-by: onur-ozkan <work@onurozkan.dev>
This commit is contained in:
parent
39acbed8d6
commit
e0fe1d6008
9
x
9
x
@ -11,10 +11,13 @@ set -eu
|
|||||||
sh -n "$0"
|
sh -n "$0"
|
||||||
|
|
||||||
realpath() {
|
realpath() {
|
||||||
if [ -d "$1" ]; then
|
local path="$1"
|
||||||
CDPATH='' command cd "$1" && pwd -P
|
if [ -L "$path" ]; then
|
||||||
|
readlink -f "$path"
|
||||||
|
elif [ -d "$path" ]; then
|
||||||
|
(cd -P "$path" && pwd)
|
||||||
else
|
else
|
||||||
echo "$(realpath "$(dirname "$1")")/$(basename "$1")"
|
echo "$(realpath "$(dirname "$path")")/$(basename "$path")"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user