From fd8b1db099cc3f69fb846fa5d4062f01ecb80590 Mon Sep 17 00:00:00 2001 From: Javi Fontan Date: Wed, 15 Sep 2010 14:28:57 +0200 Subject: [PATCH] Bug #312: fix_paths is only run if VMDIR and VAR dir are different --- src/tm_mad/tm_common.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/tm_mad/tm_common.sh b/src/tm_mad/tm_common.sh index 605ebd6197..32628fb7b1 100644 --- a/src/tm_mad/tm_common.sh +++ b/src/tm_mad/tm_common.sh @@ -45,6 +45,8 @@ function get_vmdir fix_var_slashes } +# Takes out uneeded slashes. Repeated and final directory slashes: +# /some//path///somewhere/ -> /some/path/somewhere function fix_dir_slashes { dirname "$1/file" | sed -E 's/\/+/\//g' @@ -58,7 +60,7 @@ function fix_var_slashes function fix_paths { - if [ -n "$VMDIR" ]; then + if [ "x$ONE_LOCAL_VAR" != "x$VMDIR" ]; then SRC_PATH=`fix_dir_slashes "$SRC_PATH"` SRC_PATH=${SRC_PATH/$VMDIR/$ONE_LOCAL_VAR} DST_PATH=`fix_dir_slashes "$DST_PATH"` @@ -68,7 +70,7 @@ function fix_paths function fix_src_path { - if [ -n "$VMDIR" ]; then + if [ "x$ONE_LOCAL_VAR" != "x$VMDIR" ]; then SRC_PATH=`fix_dir_slashes "$SRC_PATH"` SRC_PATH=${SRC_PATH/$VMDIR/$ONE_LOCAL_VAR} fi @@ -76,7 +78,7 @@ function fix_src_path function fix_dst_path { - if [ -n "$VMDIR" ]; then + if [ "x$ONE_LOCAL_VAR" != "x$VMDIR" ]; then DST_PATH=`fix_dir_slashes "$DST_PATH"` DST_PATH=${DST_PATH/$VMDIR/$ONE_LOCAL_VAR} fi