Skip to content

Commit 970e556

Browse files
authored
Align PATH update logic
1 parent 21ff1e5 commit 970e556

1 file changed

Lines changed: 8 additions & 9 deletions

File tree

scripts/install.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -260,14 +260,13 @@ configure_install_dir_path() {
260260
local profile_dir
261261
profile_dir=$(dirname "$PATH_PROFILE")
262262

263-
if [[ ":${PATH:-}:" != *":$INSTALL_DIR:"* ]]; then
264-
if [[ -n "${PATH:-}" ]]; then
265-
export PATH="$INSTALL_DIR:$PATH"
266-
else
267-
export PATH="$INSTALL_DIR"
268-
fi
269-
log_info "Added $INSTALL_DIR to PATH for this installer session"
270-
fi
263+
case ":${PATH:-}:" in
264+
*:"$INSTALL_DIR":*) ;;
265+
*)
266+
export PATH="$INSTALL_DIR${PATH:+:$PATH}"
267+
log_info "Added $INSTALL_DIR to PATH for this installer session"
268+
;;
269+
esac
271270

272271
if ! mkdir -p "$profile_dir"; then
273272
log_error "Failed to create PATH profile directory: $profile_dir"
@@ -281,7 +280,7 @@ case ":\${PATH:-}:" in
281280
esac
282281
EOF
283282
then
284-
log_error "Failed to write PATH profile to: $PATH_PROFILE"
283+
log_error "Failed to write PATH profile to: $PATH_PROFILE. Check permissions and available disk space."
285284
return 1
286285
fi
287286

0 commit comments

Comments
 (0)