Skip to content

Commit

Permalink
Fix for realpath /root returning //root. (#1451)
Browse files Browse the repository at this point in the history
  • Loading branch information
darabos committed Aug 28, 2021
1 parent d92f682 commit e72f2f4
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ realpath () {

if [ "$TARGET_FILE" == "." -o "$TARGET_FILE" == ".." ]; then
cd "$TARGET_FILE"
TARGET_FILEPATH=
fi
TARGET_DIR="$(pwd -P)"
if [ "$TARGET_DIR" == "/" ]; then
TARGET_FILE="/$TARGET_FILE"
else
TARGET_FILEPATH=/$TARGET_FILE
TARGET_FILE="$TARGET_DIR/$TARGET_FILE"
fi

# make sure we grab the actual windows path, instead of cygwin's path.
if [[ "x$CHECK_CYGWIN" == "x" ]]; then
echo "$(pwd -P)/$TARGET_FILE"
echo "$TARGET_FILE"
else
echo $(cygwinpath "$(pwd -P)/$TARGET_FILE")
echo $(cygwinpath "$TARGET_FILE")
fi
)
}
Expand Down

0 comments on commit e72f2f4

Please sign in to comment.