mirror of
https://github.com/gnustep/tools-make.git
synced 2025-04-22 22:00:49 +00:00
Tidied fixpath.sh
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/tools/make/trunk@13081 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
5a655f6e08
commit
c57fea65a2
1 changed files with 36 additions and 13 deletions
49
fixpath.sh
49
fixpath.sh
|
@ -40,24 +40,47 @@ fi
|
|||
operation=$1
|
||||
file=$2
|
||||
|
||||
# convert to Unix style file name
|
||||
if [ "$operation" = "-u" ]; then
|
||||
file=`echo "$file" | tr '\\\' '/'`
|
||||
#
|
||||
# convert to Unix style file name
|
||||
#
|
||||
if [ "$GNUSTEP_HOST_OS" = "cygwin" ]; then
|
||||
echo $file | sed 's/^\([a-zA-Z]\):\(.*\)$/\/cygdrive\/\1\2/'
|
||||
#
|
||||
# drive:directory --> /cygdrive/drive/directory
|
||||
#
|
||||
echo $file | \
|
||||
tr '\\' '/' | \
|
||||
sed 's/^\([a-zA-Z]\):\(.*\)$/\/cygdrive\/\1\2/'
|
||||
else
|
||||
echo $file | sed 's/^\([a-zA-Z]\):\(.*\)$/\/\1\2/'
|
||||
#
|
||||
# drive:directory --> /drive/directory
|
||||
#
|
||||
echo $file | \
|
||||
tr '\\' '/' | \
|
||||
sed 's/^\([a-zA-Z]\):\(.*\)$/\/\1\2/' | \
|
||||
sed 's/\/\//\//'
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# convert to Windows style file name
|
||||
if [ "$GNUSTEP_HOST_OS" = "cygwin" ]; then
|
||||
file=`echo $file | sed 's/^\(\/cygdrive\)\?\/\([a-zA-Z]\)\(\/.*\)$/\2:\3/'`
|
||||
else
|
||||
file=`echo $file | sed 's/^\(\/\)\?\/\([a-zA-Z]\)\(\/.*\)$/\2:\3/'`
|
||||
#
|
||||
# convert to Windows style file name
|
||||
#
|
||||
if [ "$GNUSTEP_HOST_OS" = "cygwin" ]; then
|
||||
#
|
||||
# /cygdrive/drive/directory --> drive:directory
|
||||
#
|
||||
echo $file | \
|
||||
sed 's/^\(\/cygdrive\)\?\/\([a-zA-Z]\)\(\/.*\)$/\2:\3/' | \
|
||||
tr '/' '\\'
|
||||
else
|
||||
#
|
||||
# /drive/directory --> drive:directory
|
||||
#
|
||||
echo $file | \
|
||||
sed 's/^\/\([a-zA-Z]\)\(\/.*\)$/\1:\2/' | \
|
||||
tr '/' '\\'
|
||||
fi
|
||||
fi
|
||||
file=`echo "$file" | tr '/' '\\\'`
|
||||
echo $file
|
||||
|
||||
exit 0
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue