2 # Copyright (C) 1999-2013 ImageMagick Studio LLC
3 # Copyright (C) 2003 - 2008 GraphicsMagick Group
5 # This program is covered by multiple licenses, which are described in
6 # LICENSE. You should have received a copy of LICENSE with this
7 # package; otherwise see http://www.imagemagick.org/script/license.php.
9 # Convert the specified POSIX path to a Windows path under MinGW and Cygwin
10 # The optional second parameter specifies the level of backslash escaping
11 # to apply for each Windows backslash position in order to support varying
12 # levels of variable substitutions in scripts.
14 # Note that Cygwin includes the 'cygpath' utility, which already provides
15 # path translation capability.
17 # Written by Bob Friesenhahn, June 2002
25 if test $escapes -gt 3
27 echo "$0: escape level must in range 0 - 3"
33 mount | sed -e 's:\\:/:g' | (
35 while read mount_entry
37 win_mount_path=`echo "$mount_entry" | sed -e 's: .*::g'`
38 unix_mount_path=`echo "$mount_entry" | sed -e 's:.* on ::;s: type .*::'`
39 temp=`echo "$arg" | sed -e "s!^$unix_mount_path!$win_mount_path!"`
40 if test "$temp" != "$arg"
43 length=${#unix_mount_path}
44 if test $length -gt $max_length
53 echo "$0: path \"$arg\" is not mounted"
58 echo "$result" | sed -e 's:/:\\:g'
61 echo "$result" | sed -e 's:/:\\\\:g'
64 echo "$result" | sed -e 's:/:\\\\\\\\:g'
67 echo "$result" | sed -e 's:/:\\\\\\\\\\\\\\\\:g'