michael@0: #!/bin/sh michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: # michael@0: # Stupid wrapper to avoid win32 dospath/cygdrive issues michael@0: # Try not to spawn programs from within this file. If the stuff in here looks royally michael@0: # confusing, see bug: http://bugzilla.mozilla.org/show_bug.cgi?id=206643 michael@0: # and look at the older versions of this file that are easier to read, but michael@0: # do basically the same thing michael@0: # michael@0: michael@0: prog=$1 michael@0: shift michael@0: if test -z "$prog"; then michael@0: exit 0 michael@0: fi michael@0: michael@0: # If $CYGDRIVE_MOUNT was not set in configure, give $mountpoint the results of mount -p michael@0: mountpoint=$CYGDRIVE_MOUNT michael@0: if test -z "$mountpoint"; then michael@0: mountpoint=`mount -p` michael@0: if test -z "$mountpoint"; then michael@0: print "Cannot determine cygwin mount points. Exiting" michael@0: exit 1 michael@0: fi michael@0: fi michael@0: michael@0: # Delete everything but "/cygdrive" (or other mountpoint) from mount=`mount -p` michael@0: mountpoint=${mountpoint#*/} michael@0: mountpoint=/${mountpoint%%[!A-Za-z0-9_]*} michael@0: mountpoint=${mountpoint%/} michael@0: michael@0: args="" michael@0: up="" michael@0: if test "${prog}" = "-up"; then michael@0: up=1 michael@0: prog=${1} michael@0: shift michael@0: fi michael@0: michael@0: process=1 michael@0: michael@0: # Convert the mountpoint in parameters to Win32 filenames michael@0: # For instance: /cygdrive/c/foo -> c:/foo michael@0: for i in "${@}" michael@0: do michael@0: if test "${i}" = "-wrap"; then michael@0: process=1 michael@0: else michael@0: if test "${i}" = "-nowrap"; then michael@0: process= michael@0: else michael@0: if test -n "${process}"; then michael@0: if test -n "${up}"; then michael@0: pathname=${i#-I[a-zA-Z]:/} michael@0: if ! test "${pathname}" = "${i}"; then michael@0: no_i=${i#-I} michael@0: driveletter=${no_i%%:*} michael@0: i=-I${mountpoint}/${driveletter}/${pathname} michael@0: fi michael@0: else michael@0: eval 'leader=${i%%'${mountpoint}'/[a-zA-Z]/*}' michael@0: if ! test "${leader}" = "${i}"; then michael@0: eval 'pathname=${i#'${leader}${mountpoint}'/[a-zA-Z]/}' michael@0: eval 'no_mountpoint=${i#'${leader}${mountpoint}'/}' michael@0: driveletter=${no_mountpoint%%/*} michael@0: i=${leader}${driveletter}:/${pathname} michael@0: fi michael@0: fi michael@0: fi michael@0: michael@0: args="${args} ${i}" michael@0: fi michael@0: fi michael@0: done michael@0: michael@0: exec $prog $args