From 5bf2f6278bef192cb942c84918aab57a4cb31a8f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Sat, 28 Jun 2014 12:34:20 +0200 Subject: Improved previous commit c75218cd This relates to Bug 2069. --- starttde | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/starttde b/starttde index f6607a129..9f093a773 100755 --- a/starttde +++ b/starttde @@ -34,7 +34,6 @@ is_before_in_path() { var="$1"; search="$2"; before="$3" ifs="$IFS"; IFS=":"; eval set \$$var; IFS="$ifs" for i in $*; do - echo "${i}, ${search}, ${before}" [ "${i}" = "${search}" ] && return 0 [ "${i}" = "${before}" ] && return 1 done @@ -279,11 +278,15 @@ if [ "$TDEDIR" != "/usr" ] && [ -d $TDEDIR/share ]; then fi # Ensure that $TDEDIR/share is always before '/usr/local/share' and '/usr/share'. - remove_from_path XDG_DATA_DIRS $TDEDIR/share - if is_before_in_path XDG_DATA_DIRS "/usr/local/share" "/usr/share"; then - place_before_in_path XDG_DATA_DIRS "$TDEDIR/share" "/usr/local/share" - else - place_before_in_path XDG_DATA_DIRS "$TDEDIR/share" "/usr/share" + if ! is_in_path XDG_DATA_DIRS "$TDEDIR/share" || + is_before_in_path XDG_DATA_DIRS "/usr/local/share" "$TDEDIR/share" || + is_before_in_path XDG_DATA_DIRS "/usr/share" "$TDEDIR/share"; then + remove_from_path XDG_DATA_DIRS "$TDEDIR/share" + if is_before_in_path XDG_DATA_DIRS "/usr/local/share" "/usr/share"; then + place_before_in_path XDG_DATA_DIRS "$TDEDIR/share" "/usr/local/share" + else + place_before_in_path XDG_DATA_DIRS "$TDEDIR/share" "/usr/share" + fi fi # Adds supplementary directories from TDEDIRS, if any, before TDEDIR. -- cgit v1.2.1