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