Skip to content

Commit ffb9787

Browse files
helpermethodmarc0der
authored andcommitted
Revert changes to sdkman-use.sh
1 parent 1f617cb commit ffb9787

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

src/main/bash/sdkman-use.sh

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,22 @@ function __sdk_use() {
2626

2727
if [[ ! -d "${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}" ]]; then
2828
echo ""
29-
__sdkman_echo_red "Stop! Candidate version is not installed."
30-
echo ""
31-
__sdkman_echo_yellow "Tip: Run the following to install this version"
32-
echo ""
33-
__sdkman_echo_yellow "$ sdk install ${candidate} ${version}"
29+
__sdkman_echo_red "Stop! ${candidate} ${version} is not installed."
3430
return 1
3531
fi
3632

3733
# Just update the *_HOME and PATH for this shell.
3834
__sdkman_set_candidate_home "$candidate" "$version"
3935

40-
if [[ $PATH =~ ${SDKMAN_CANDIDATES_DIR}/${candidate}/([^/]+) ]]; then
41-
export PATH=${PATH//${SDKMAN_CANDIDATES_DIR}\/${candidate}\/${BASH_REMATCH[1]}/${SDKMAN_CANDIDATES_DIR}\/${candidate}\/${version}}
36+
# Replace the current path for the candidate with the selected version.
37+
if [[ "$solaris" == true ]]; then
38+
export PATH=$(echo $PATH | gsed -r "s!${SDKMAN_CANDIDATES_DIR}/${candidate}/([^/]+)!${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}!g")
39+
40+
elif [[ "$darwin" == true ]]; then
41+
export PATH=$(echo $PATH | sed -E "s!${SDKMAN_CANDIDATES_DIR}/${candidate}/([^/]+)!${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}!g")
42+
43+
else
44+
export PATH=$(echo "$PATH" | sed -r "s!${SDKMAN_CANDIDATES_DIR}/${candidate}/([^/]+)!${SDKMAN_CANDIDATES_DIR}/${candidate}/${version}!g")
4245
fi
4346

4447
if [[ ! (-L "${SDKMAN_CANDIDATES_DIR}/${candidate}/current" || -d "${SDKMAN_CANDIDATES_DIR}/${candidate}/current") ]]; then

0 commit comments

Comments
 (0)