Skip to content

Commit 566b215

Browse files
authored
fix(asdf): use LIB_DIR instead of DIR to avoid clashing (#708)
`DIR` is a common pattern used in devbase to determine the current running directory. Unfortunately, some of our libraries have _also_ started to use it. This ends up in secenarios where `DIR` can be overwritten by an imported script. To avoid this, we've used `LIB_DIR` inside the libraries to prevent clashes from causing an issue. In reality, we shouldn't be using Bash which would help... for now this fixes it by changing the newly added `DIR` to be `LIB_DIR`.
1 parent 453ae05 commit 566b215

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

shell/lib/asdf.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
#!/usr/bin/env bash
22
# Utilities for working with asdf
33

4-
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
4+
# LIB_DIR is the directory that shell script libraries live in.
5+
LIB_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
56

67
# shellcheck source=./shell.sh
7-
source "${DIR}/shell.sh"
8+
source "${LIB_DIR}/shell.sh"
89

910
ensure_bash_5_or_greater
1011

0 commit comments

Comments
 (0)