looper/setup-android-project.sh

21 lines
755 B
Bash
Raw Normal View History

#!/bin/env -S NOT_SOURCED=1 /bin/sh
if ! [ "$NOT_SOURCED" = "1" ]; then
echo "Error: This script must not be sourced!" >&2
return 1
fi
get_abs_filename() {
echo "$(cd "$(dirname "$1")" && pwd)/$(basename "$1")" | sed 's@/\./@/@g' | sed 's@/\.$@@g'
}
export PROJECT_DIR="$(get_abs_filename $(dirname "$0"))"
export ANDROID_PROJECT_DIR="${PROJECT_DIR}/sdl-android-project"
export ANDROID_APP_DIR="${ANDROID_PROJECT_DIR}/app"
export ANDROID_JNI_DIR="${ANDROID_APP_DIR}/jni"
echo "Project directory: $PROJECT_DIR"
echo "Android project directory: $ANDROID_PROJECT_DIR"
echo "Android JNI symlink: $ANDROID_JNI_DIR -> $PROJECT_DIR"
pushd "${PROJECT_DIR}"
[ -d "$ANDROID_JNI_DIR" ] && rm -rf "$ANDROID_JNI_DIR"
ln -sf "$PROJECT_DIR" "$ANDROID_JNI_DIR"
popd