From a6c21a156e537e3f4e4d345f9280ab29bc74ec29 Mon Sep 17 00:00:00 2001 From: Serge Guzik Date: Mon, 11 Feb 2019 17:28:20 +0200 Subject: [PATCH] feat: Choose cache directory based on the OS --- warp4j | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/warp4j b/warp4j index 223906d..6c3973b 100755 --- a/warp4j +++ b/warp4j @@ -199,6 +199,9 @@ JAR_EXTENSION="${JAR_FILE_BASE_NAME##*.}" JAR_EXTENSION_LOWERCASE=$(printf "%s" "$JAR_EXTENSION" | tr '[:upper:]' '[:lower:]') JAR_NAME="${JAR_FILE_BASE_NAME%.*}" +APP_NAME=$JAR_NAME +LAUNCHER_NAME=$JAR_NAME + # checking jar file exists if [[ ! -e $JAR ]]; then echo "Error: File \"$JAR\" does not exist" >&2 @@ -233,13 +236,17 @@ function choose_distro_type() { JAVA_DISTRO_TYPE=$(choose_distro_type) -APP_NAME=$JAR_NAME -LAUNCHER_NAME=$JAR_NAME +case $THIS_PLATFORM in + $MAC) CACHE_PATH="$HOME/Library/Application Support/warp4j" ;; + $WIN) CACHE_PATH='%LOCALAPPDATA%\warp4j';; + *) CACHE_PATH="$HOME/.local/share/warp4j" ;; +esac -DIR="$(pwd -P)" -CACHE_PATH=$HOME/.local/share/warp4j JAVA_DOWNLOAD_PATH=$CACHE_PATH/$JAVA_DISTRO_TYPE/$JVM_IMPL BUNDLES_PATH=$CACHE_PATH/bundle + +# execution directory path +DIR="$(pwd -P)" WARPED_PATH=$DIR/warped BUNDLED_DISTRO_SUBDIR="java"