feat: Choose cache directory based on the OS

This commit is contained in:
Serge Guzik 2019-02-11 17:28:20 +02:00
parent f74f905f74
commit a6c21a156e

15
warp4j
View File

@ -199,6 +199,9 @@ JAR_EXTENSION="${JAR_FILE_BASE_NAME##*.}"
JAR_EXTENSION_LOWERCASE=$(printf "%s" "$JAR_EXTENSION" | tr '[:upper:]' '[:lower:]') JAR_EXTENSION_LOWERCASE=$(printf "%s" "$JAR_EXTENSION" | tr '[:upper:]' '[:lower:]')
JAR_NAME="${JAR_FILE_BASE_NAME%.*}" JAR_NAME="${JAR_FILE_BASE_NAME%.*}"
APP_NAME=$JAR_NAME
LAUNCHER_NAME=$JAR_NAME
# checking jar file exists # checking jar file exists
if [[ ! -e $JAR ]]; then if [[ ! -e $JAR ]]; then
echo "Error: File \"$JAR\" does not exist" >&2 echo "Error: File \"$JAR\" does not exist" >&2
@ -233,13 +236,17 @@ function choose_distro_type() {
JAVA_DISTRO_TYPE=$(choose_distro_type) JAVA_DISTRO_TYPE=$(choose_distro_type)
APP_NAME=$JAR_NAME case $THIS_PLATFORM in
LAUNCHER_NAME=$JAR_NAME $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 JAVA_DOWNLOAD_PATH=$CACHE_PATH/$JAVA_DISTRO_TYPE/$JVM_IMPL
BUNDLES_PATH=$CACHE_PATH/bundle BUNDLES_PATH=$CACHE_PATH/bundle
# execution directory path
DIR="$(pwd -P)"
WARPED_PATH=$DIR/warped WARPED_PATH=$DIR/warped
BUNDLED_DISTRO_SUBDIR="java" BUNDLED_DISTRO_SUBDIR="java"