[pitivi] bin: Fix SCRIPTDIR setting in bash



commit b7857a607130c9891d6ffc175e41e6f42070eb1f
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Fri Apr 15 00:54:35 2016 +0200

    bin: Fix SCRIPTDIR setting in bash
    
    Differential Revision: https://phabricator.freedesktop.org/D939

 bin/pitivi-xdg-app-env |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/bin/pitivi-xdg-app-env b/bin/pitivi-xdg-app-env
index 4de57ce..b03d83f 100755
--- a/bin/pitivi-xdg-app-env
+++ b/bin/pitivi-xdg-app-env
@@ -1,10 +1,13 @@
 #!/bin/bash
 
-[[ "${BASH_SOURCE[0]}" == "${0}" ]] \
+# This has to be the first command because BASH_SOURCE[0] gets changed.
+SCRIPT=${BASH_SOURCE[0]:-$0}
+
+[[ "${BASH_SOURCE[0]}" == "$0" ]] \
     && printf "This script should not be executed but sourced like:\n    $ source $0\n" \
     && exit 1
 
-SCRIPTDIR=$(dirname $(realpath $_))
+SCRIPTDIR=$(dirname $(realpath $SCRIPT))
 export XDGAPP_ENVPATH=$(realpath $SCRIPTDIR/../../)
 export CURRENT_GST=$XDGAPP_ENVPATH
 export MYPITIVI=$XDGAPP_ENVPATH


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]