1 | #!/bin/sh
|
---|
2 | #
|
---|
3 | # Stupid wrapper to avoid win32 dospath/cygdrive issues
|
---|
4 | # Try not to spawn programs from within this file. If the stuff in here looks royally
|
---|
5 | # confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643
|
---|
6 | # and look at the older versions of this file that are easier to read, but
|
---|
7 | # do basically the same thing
|
---|
8 | #
|
---|
9 |
|
---|
10 | prog=$1
|
---|
11 | shift
|
---|
12 | if test -z "$prog"; then
|
---|
13 | exit 0
|
---|
14 | fi
|
---|
15 |
|
---|
16 | # If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p
|
---|
17 | mountpoint=$CYGDRIVE_MOUNT
|
---|
18 | if test -z "$mountpoint"; then
|
---|
19 | mountpoint=`mount -p`
|
---|
20 | if test -z "$mountpoint"; then
|
---|
21 | print "Cannot determine cygwin mount points. Exiting"
|
---|
22 | exit 1
|
---|
23 | fi
|
---|
24 | fi
|
---|
25 |
|
---|
26 | # Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p`
|
---|
27 | mountpoint=${mountpoint#*/}
|
---|
28 | mountpoint=/${mountpoint%%[!A-Za-z0-9_]*}
|
---|
29 | mountpoint=${mountpoint%/}
|
---|
30 |
|
---|
31 | args=""
|
---|
32 | up=""
|
---|
33 | if test "${prog}" = "-up"; then
|
---|
34 | up=1
|
---|
35 | prog=${1}
|
---|
36 | shift
|
---|
37 | fi
|
---|
38 |
|
---|
39 | process=1
|
---|
40 |
|
---|
41 | # Convert the mountpoint in parameters to Win32 filenames
|
---|
42 | # For instance: /cygdrive/c/foo -> c:/foo
|
---|
43 | for i in "${@}"
|
---|
44 | do
|
---|
45 | if test "${i}" = "-wrap"; then
|
---|
46 | process=1
|
---|
47 | else
|
---|
48 | if test "${i}" = "-nowrap"; then
|
---|
49 | process=
|
---|
50 | else
|
---|
51 | if test -n "${process}"; then
|
---|
52 | if test -n "${up}"; then
|
---|
53 | pathname=${i#-I[a-zA-Z]:/}
|
---|
54 | if ! test "${pathname}" = "${i}"; then
|
---|
55 | no_i=${i#-I}
|
---|
56 | driveletter=${no_i%%:*}
|
---|
57 | i=-I${mountpoint}/${driveletter}/${pathname}
|
---|
58 | fi
|
---|
59 | else
|
---|
60 | eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}'
|
---|
61 | if ! test "${leader}" = "${i}"; then
|
---|
62 | eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}'
|
---|
63 | eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}'
|
---|
64 | driveletter=${no_mountpoint%%/*}
|
---|
65 | i=${leader}${driveletter}:/${pathname}
|
---|
66 | fi
|
---|
67 | fi
|
---|
68 | fi
|
---|
69 |
|
---|
70 | args="${args} ${i}"
|
---|
71 | fi
|
---|
72 | fi
|
---|
73 | done
|
---|
74 |
|
---|
75 | exec $prog $args
|
---|