From beb481d2a7ed71c444544890586c16385594e7eb Mon Sep 17 00:00:00 2001 From: Martin Scheidt Date: Wed, 9 Mar 2022 18:32:29 +0100 Subject: [PATCH] enhanced path check in build script --- build.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index accebf4..131557d 100755 --- a/build.sh +++ b/build.sh @@ -128,10 +128,24 @@ sedi () { ## -- commands check_path() { - if [ ! -d ../tikz-trackschematic ]; then - echo "${RED}Please run this script from inside the project folder!${COLOR_RESET}" - exit 1 + # test for project specific files + STATUS=0 + FILES=(doc/tikz-trackschematic-documentation.sty src/tikz-trackschematic.sty test/turnout.tex) + for FILE in ${FILES[@]}; do + if [ ! -e $FILE ]; then + STATUS=1 + fi + done + + if [ $STATUS = 0 ]; then + if [ $VERBOSE = 1 ]; then + echo "Build script is within the project folder." + fi + return 0 fi + + echo "${RED}Please run this script from inside the project folder!${COLOR_RESET}" + exit 1 } ## checks for installed software