Skip to content

Commit b34640a

Browse files
committed
tidy up BPIPE_HOME to not use .. in paths
1 parent 2b22c0d commit b34640a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

bin/bpipe

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,8 @@ function handle_sigint() {
286286
#----------------------------------------------------------
287287
get_classpath() {
288288

289+
ECLIPSE_BUILD="$BPIPE_HOME/eclipse-build"
290+
289291
if [ ! -z "$NO_ECLIPSE_CLASSES" ];
290292
then
291293
ECLIPSE_CLASSPATH=""
@@ -315,10 +317,10 @@ get_classpath() {
315317

316318
# In case we are running in place in the bpipe project root, we pre-empt any other
317319
# bpipe classes with those from the build directory and the eclipse compile path
318-
if [ -e $BPIPE_HOME/build/classes/groovy/main ] || [ -e $BPIPE_HOME/eclipse-build ];
320+
if [ -e $BPIPE_HOME/build/classes/groovy/main ] || [ -e "$ECLIPSE_BUILD" ];
319321
then
320322
CP="${ECLIPSE_CLASSPATH}$BPIPE_HOME/build/classes/groovy/main:$CP:$BPIPE_HOME/build/libs/bpipe-all.jar"
321-
BPIPE_JAR="$BPIPE_HOME/build/classes/groovy/main:$BPIPE_JAR"
323+
BPIPE_JAR="$ECLIPSE_CLASSPATH:$BPIPE_HOME/build/classes/groovy/main:$BPIPE_JAR"
322324
fi
323325

324326
# Support for Cygwin: convert the class path to windows format
@@ -422,9 +424,12 @@ function set_bpipe_home() {
422424
# Note: the first test below is necessary for Cygwin
423425
if readlink $0 > /dev/null && type readlink > /dev/null 2>&1 ;
424426
then
425-
BPIPE_HOME=$(dirname $(readlink -f $0))/..
427+
BPIPE_HOME=$(dirname $(readlink -f $0/..))
428+
elif type realpath > /dev/null;
429+
then
430+
BPIPE_HOME=$(dirname $(realpath $(dirname $0)))
426431
else
427-
BPIPE_HOME=`dirname $0`/..
432+
BPIPE_HOME=$(dirname $(dirname $0))
428433
fi
429434

430435
# For Cygwin, we need windows compatible version of path for JVM to use

0 commit comments

Comments
 (0)