From 3e285e47372b69ebf1c4ac9f1d99954452ca4774 Mon Sep 17 00:00:00 2001 From: Scott Duensing Date: Wed, 26 Jun 2019 21:12:14 -0500 Subject: [PATCH] (Mostly) Fixed tGetParentPath. --- towel.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/towel.sh b/towel.sh index 1f9a866..6f1b4df 100755 --- a/towel.sh +++ b/towel.sh @@ -35,6 +35,12 @@ tPURPLE=5 tCYAN=6 +# +# Global variables used by Towel. +# +__tG__PARENTPATH="${BASH_SOURCE[0]}" + + # # Draws bold white text inside a colored box. # @@ -231,8 +237,10 @@ function tGetParentPath() { local __RESULT=$1 local __PARENTPATH= - tFindPath __PARENTPATH "${BASH_SOURCE[1]}" - __TOWELPATH="${__PARENTPATH}/`basename \"${BASH_SOURCE[1]}\"`" + # We have to initialize __tG__PARENTPATH before the calling script + # changes directories elsewhere. We set it on load. + tFindPath __PARENTPATH "${__tG__PARENTPATH}" + __TOWELPATH="${__PARENTPATH}/`basename \"${__tG__PARENTPATH}\"`" eval $__RESULT=\${__PARENTPATH} }