From 62ac80be7c25897637dba890c8791aa338b84b3e Mon Sep 17 00:00:00 2001 From: ViViDboarder Date: Mon, 24 Jun 2024 11:51:47 -0700 Subject: [PATCH] Clean up android and java paths --- assets/default/dotfiles/bashrc | 14 +++++++++----- assets/default/dotfiles/zshrc | 14 +++++++++----- assets/default/fish/init/paths.fish | 12 +++++++++--- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/assets/default/dotfiles/bashrc b/assets/default/dotfiles/bashrc index 33d3212..a31ab94 100644 --- a/assets/default/dotfiles/bashrc +++ b/assets/default/dotfiles/bashrc @@ -24,10 +24,10 @@ if [ -d /opt/local ]; then fi if [[ "$DET_OS" == "linux" ]]; then - ANDROID_SDK=$HOME/workspace/adt-bundle-linux/sdk + export ANDROID_HOME="$HOME/workspace/adt-bundle-linux/sdk" GOROOT=/usr/local/go elif [[ "$DET_OS" == "mac" ]]; then - ANDROID_SDK=$HOME/workspace/android-sdk-macosx + export ANDROID_HOME="$HOME/Library/Android/sdk" # Set GOPATH GOROOT=/opt/local/lib/go @@ -47,9 +47,13 @@ elif [[ "$DET_OS" == "mac" ]]; then fi # Android paths -if [ -d "$ANDROID_SDK" ]; then - export ANDROID_HOME=$ANDROID_SDK - export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools +if [ -d "$ANDROID_HOME" ]; then + export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools +fi + +# Java paths +if type /usr/libexec/java_home &> /dev/null ; then + export JAVA_HOME="$(/usr/libexec/java_home)" fi # Go paths diff --git a/assets/default/dotfiles/zshrc b/assets/default/dotfiles/zshrc index 4a75b51..139ef8f 100644 --- a/assets/default/dotfiles/zshrc +++ b/assets/default/dotfiles/zshrc @@ -25,9 +25,9 @@ if [ -d /opt/local ]; then fi if [[ "$DET_OS" == "linux" ]]; then - ANDROID_SDK=$HOME/workspace/adt-bundle-linux/sdk + export ANDROID_HOME="$HOME/workspace/adt-bundle-linux/sdk" elif [[ "$DET_OS" == "mac" ]]; then - ANDROID_SDK=$HOME/workspace/android-sdk-macosx + export ANDROID_HOME="$HOME/Library/Android/sdk" # Set GOPATH GOROOT=/opt/local/lib/go @@ -47,9 +47,13 @@ elif [[ "$DET_OS" == "mac" ]]; then fi # Android paths -if [ -d "$ANDROID_SDK" ]; then - export ANDROID_HOME=$ANDROID_SDK - export PATH=$PATH:$ANDROID_SDK/platform-tools:$ANDROID_SDK/tools +if [ -d "$ANDROID_HOME" ]; then + export PATH=$PATH:$ANDROID_HOME/platform-tools:$ANDROID_HOME/tools +fi + +# Java paths +if type /usr/libexec/java_home &> /dev/null ; then + export JAVA_HOME="$(/usr/libexec/java_home)" fi # Go paths diff --git a/assets/default/fish/init/paths.fish b/assets/default/fish/init/paths.fish index 81bf767..fa52e3e 100644 --- a/assets/default/fish/init/paths.fish +++ b/assets/default/fish/init/paths.fish @@ -77,10 +77,16 @@ _maybe_set -p PATH "/usr/local/go/bin" if [ $det_os = "linux" ] set -gx ANDROID_HOME "$HOME/workspace/adt-bundle-linux/sdk" else if [ $det_os = "mac" ] - set -gx ANDROID_HOME "$HOME/workspace/android-sdk-macosx" + set -gx ANDROID_HOME "$HOME/Library/Android/sdk" +end +_maybe_set -a PATH "$ANDROID_HOME/tools" +_maybe_set -a PATH "$ANDROID_HOME/tools/bin" +_maybe_set -a PATH "$ANDROID_HOME/platform-tools" + +# Java paths +if type -q /usr/libexec/java_home + set -gx JAVA_HOME (/usr/libexec/java_home) end -_maybe_set -a PATH "$ANDROID_PATH/platform-tools" -_maybe_set -a PATH "$ANDROID_PATH/tools" # Ruby paths if type -q rbenv ; and status --is-interactive