diff --git a/app/views/includes/sanity.scala.txt b/app/views/includes/sanity.scala.txt index 96c1b60..08d57c5 100644 --- a/app/views/includes/sanity.scala.txt +++ b/app/views/includes/sanity.scala.txt @@ -1,7 +1,23 @@ # Sanity checks +echo "Validating installation location..." +if [ -e "$SDKMAN_DIR" ] && [ ! -d "$SDKMAN_DIR" ]; then + echo "Cannot install to requested location." + echo "" + echo "======================================================================================================" + echo " A file of the same name as the installation directory exists." + echo " File in conflict is:" + echo "" + echo " ${SDKMAN_DIR}" + echo "" + echo " Restart after removing the existing file or choosing a different installation location." + echo "======================================================================================================" + echo "" + exit 1 +fi + echo "Looking for a previous installation of SDKMAN..." -if [ -d "$SDKMAN_DIR" ]; then +if [ -d "$SDKMAN_DIR" ] && [ ! -z $(ls -A "$SDKMAN_DIR") ]; then echo "SDKMAN found." echo "" echo "======================================================================================================" @@ -84,4 +100,4 @@ else echo "" exit 1 fi -fi \ No newline at end of file +fi diff --git a/app/views/install_beta.scala.txt b/app/views/install_beta.scala.txt index 343ceb9..c8ffc32 100644 --- a/app/views/install_beta.scala.txt +++ b/app/views/install_beta.scala.txt @@ -10,10 +10,11 @@ SDKMAN_NATIVE_VERSION="@cliNativeVersion" SDKMAN_PLATFORM=$(uname) if [ -z "$SDKMAN_DIR" ]; then - SDKMAN_DIR="$HOME/.sdkman" + SDKMAN_DIR=$(readlink -f "$HOME/.sdkman") SDKMAN_DIR_RAW='$HOME/.sdkman' else SDKMAN_DIR_RAW="$SDKMAN_DIR" + SDKMAN_DIR=$(readlink -f $SDKMAN_DIR) fi # Local variables @@ -140,4 +141,4 @@ fi } -@includes.install_message(beta) \ No newline at end of file +@includes.install_message(beta) diff --git a/app/views/install_stable.scala.txt b/app/views/install_stable.scala.txt index 015dcbd..1b0e49f 100644 --- a/app/views/install_stable.scala.txt +++ b/app/views/install_stable.scala.txt @@ -9,10 +9,11 @@ SDKMAN_VERSION="@cliVersion" SDKMAN_PLATFORM=$(uname) if [ -z "$SDKMAN_DIR" ]; then - SDKMAN_DIR="$HOME/.sdkman" + SDKMAN_DIR=$(readlink -f "$HOME/.sdkman") SDKMAN_DIR_RAW='$HOME/.sdkman' else SDKMAN_DIR_RAW="$SDKMAN_DIR" + SDKMAN_DIR=$(readlink -f $SDKMAN_DIR) fi # Local variables @@ -136,4 +137,4 @@ fi } -@includes.install_message(beta) \ No newline at end of file +@includes.install_message(beta)