We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9c81bb9 + 87a5384 commit 07a2db8Copy full SHA for 07a2db8
1 file changed
shell_hook.sh
@@ -51,6 +51,28 @@ update_path() {
51
# echo "$TOOL_NAME: Added $tool_bin_dir to PATH"
52
;;
53
esac
54
+ else
55
+ # If the directory doesn't exist, remove any stale tool entries from PATH
56
+ if [[ ":$PATH:" == *"/$TOOL_FOLDER/active:"* ]]; then
57
+ local p
58
+ local new_path=""
59
+ local current_path="$PATH"
60
+
61
+ while [ -n "$current_path" ]; do
62
+ p="${current_path%%:*}"
63
64
+ if [ "$current_path" = "$p" ]; then
65
+ current_path=""
66
67
+ current_path="${current_path#*:}"
68
+ fi
69
70
+ if [[ "$p" != *"/$TOOL_FOLDER/active" ]]; then
71
+ new_path="${new_path:+$new_path:}$p"
72
73
+ done
74
+ export PATH="$new_path"
75
76
fi
77
}
78
0 commit comments