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