Skip to content

Commit

Permalink
Merge branch 'master' into fix-shebang
Browse files Browse the repository at this point in the history
  • Loading branch information
erlingrj authored Nov 7, 2024
2 parents 4487f22 + 1973c27 commit 00e5166
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion env.bash
Original file line number Diff line number Diff line change
@@ -1,8 +1,22 @@
#!/usr/bin/env bash

# From https://stackoverflow.com/questions/59895/how-do-i-get-the-directory-where-a-bash-script-is-located-from-within-the-script
FLEXPRET_ROOT=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
# The top solution does not work on macOS.
# The solution below comes from this answer: https://stackoverflow.com/a/179231
pushd . > '/dev/null';
SCRIPT_PATH="${BASH_SOURCE[0]:-$0}";

while [ -h "$SCRIPT_PATH" ];
do
cd "$( dirname -- "$SCRIPT_PATH"; )";
SCRIPT_PATH="$( readlink -f -- "$SCRIPT_PATH"; )";
done

cd "$( dirname -- "$SCRIPT_PATH"; )" > '/dev/null';
SCRIPT_PATH="$( pwd; )";
popd > '/dev/null';

FLEXPRET_ROOT=$SCRIPT_PATH
export PATH="$FLEXPRET_ROOT/build/emulator:$PATH"
export FP_PATH="$FLEXPRET_ROOT"
export FP_SDK_PATH="$FLEXPRET_ROOT/sdk"

0 comments on commit 00e5166

Please sign in to comment.