mirror of
https://github.com/pyenv/pyenv.git
synced 2025-11-09 12:03:49 -05:00
Merge pull request #1216 from blueyed/abs_dirname
Fix abs_dirname for relative symlinks in same directory
This commit is contained in:
@@ -60,20 +60,21 @@ resolve_link() {
|
||||
}
|
||||
|
||||
abs_dirname() {
|
||||
local cwd="$(pwd)"
|
||||
local path="$1"
|
||||
|
||||
# Use a subshell to avoid modifying the current path
|
||||
# Use a subshell to avoid changing the current path
|
||||
(
|
||||
while [ -n "$path" ]; do
|
||||
cd "${path%/*}"
|
||||
local name="${path##*/}"
|
||||
cd_path="${path%/*}"
|
||||
if [[ "$cd_path" != "$path" ]]; then
|
||||
cd "$cd_path"
|
||||
fi
|
||||
name="${path##*/}"
|
||||
path="$(resolve_link "$name" || true)"
|
||||
done
|
||||
|
||||
pwd
|
||||
echo "$PWD"
|
||||
)
|
||||
# cd "$cwd"
|
||||
}
|
||||
|
||||
capitalize() {
|
||||
|
||||
Reference in New Issue
Block a user