3 # Conversion of an absolute path to a relative path.
5 # Copyright (c) 2008 by Marc Feeley, All Rights Reserved.
7 TARGET_PATH
=`echo "$1" | sed -e 's#\\\\#/#g' -e 's#//*#/#g' -e 's#/$##' -e 's#\([/]\{0,1\}\)\(.*\)#\2/#' -e 's#^/$##'`
8 ORIG_DIR
=`echo "$2" | sed -e 's#\\\\#/#g' -e 's#//*#/#g' -e 's#/$##' -e 's#\([/]\{0,1\}\)\(.*\)#\2/#' -e 's#^/$##'`
11 while test "$TARGET_PATH" != "" -a "$ORIG_DIR" != ""; do
12 TP_CAR
=`echo "$TARGET_PATH" | sed -e 's#\([^/]*[/]\)\(.*\)#\1#'`
13 TP_CDR
=`echo "$TARGET_PATH" | sed -e 's#\([^/]*[/]\)\(.*\)#\2#'`
14 OD_CAR
=`echo "$ORIG_DIR" | sed -e 's#\([^/]*[/]\)\(.*\)#\1#'`
15 OD_CDR
=`echo "$ORIG_DIR" | sed -e 's#\([^/]*[/]\)\(.*\)#\2#'`
16 if test "$TP_CAR" = "$OD_CAR"; then
24 REL_PATH
=`echo "$ORIG_DIR" | sed -e 's#[^/]*[/]#../#g'`"$TARGET_PATH"
26 if test "$ENABLE_MV" = "yes"; then
27 echo "$REL_PATH" |
sed -e 's#^#/#' -e 's#^\(.*/\)\([^/][^/]*\)/\([^/][^/]*\)/$#\1current/\3/#' -e 's#^/##'