File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -90,9 +90,15 @@ function __sdkman_install_local_version {
9090 folder=" $( pwd) /$folder "
9191 fi
9292
93- __sdkman_echo_green " Linking ${candidate} ${version} to ${folder} "
94- ln -s " $folder " " ${SDKMAN_CANDIDATES_DIR} /${candidate} /${version} "
95- __sdkman_echo_green " Done installing!"
93+ if [[ -d " $folder " ]]; then
94+ __sdkman_echo_green " Linking ${candidate} ${version} to ${folder} "
95+ ln -s " $folder " " ${SDKMAN_CANDIDATES_DIR} /${candidate} /${version} "
96+ __sdkman_echo_green " Done installing!"
97+
98+ else
99+ __sdkman_echo_red " Invalid path! Refusing to link ${candidate} ${version} to ${folder} ."
100+ fi
101+
96102 echo " "
97103}
98104
Original file line number Diff line number Diff line change @@ -51,10 +51,17 @@ Feature: Local Development Versions
5151 Then I see "Using groovy version 2.1-SNAPSHOT in this shell"
5252 And the candidate "groovy" version "2.1-SNAPSHOT" should be in use
5353
54- Scenario : Install a local development version from a relative path
54+ Scenario : Install a local development version from a valid relative path
5555 Given the candidate "groovy" version "2.1-SNAPSHOT" is not available for download
5656 And I have a local candidate "groovy" version "2.1-SNAPSHOT" at relative path "some/relative/path/to/groovy"
5757 And the system is bootstrapped
5858 When I enter "sdk install groovy 2.1-SNAPSHOT some/relative/path/to/groovy"
5959 Then I see "Linking groovy 2.1-SNAPSHOT"
6060 And the candidate "groovy" version "2.1-SNAPSHOT" is linked to the relative path "some/relative/path/to/groovy"
61+
62+ Scenario : Prevent installation of a local development version for an invalid path
63+ Given the candidate "groovy" version "2.1-SNAPSHOT" is not available for download
64+ And the system is bootstrapped
65+ When I enter "sdk install groovy 2.1-SNAPSHOT /some/bogus/path/to/groovy"
66+ Then I see "Invalid path! Refusing to link groovy 2.1-SNAPSHOT to /some/bogus/path/to/groovy."
67+ And the candidate "groovy" version "2.1-SNAPSHOT" is not installed
You can’t perform that action at this time.
0 commit comments