From 17aafe343961bbb73658a0f55c1ab1d1624e423e Mon Sep 17 00:00:00 2001 From: Julian Ospald Date: Thu, 18 Apr 2019 11:37:42 +0800 Subject: [PATCH] posix_realpath: if dir does not exist also append to current dir This matches realpath behavior. --- ghcup | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/ghcup b/ghcup index 6ccb855..df1b215 100755 --- a/ghcup +++ b/ghcup @@ -1127,7 +1127,7 @@ get_distro_alias() { # and # https://stackoverflow.com/a/246128 # -# If the file does not exist, just prints the argument unchanged. +# If the file does not exist, just prints it appended to the current directory. # @STDOUT: realpath of the given file posix_realpath() { [ -z "$1" ] && die "Internal error: no argument given to posix_realpath" @@ -1151,8 +1151,6 @@ posix_realpath() { # TODO: better distinguish between "does not exist" and "permission denied" if [ -z "${mydir}" ] ; then (>&2 echo "${1}: Permission denied") - elif [ ! -e "$1" ] ; then - echo "${mysource}" else echo "${mydir%/}/$(basename "${mysource}")" fi