This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: environment variables derived from TMPDIR


Hi Ralf,


Ralf Fassel <ralfixx <at> gmx.de> writes:

> 
> In a SHELL script I prepare a temp file to pass to some non-cygwin
> program:
> 
>     # TMPDIR is set to c:/temp outside of cygwin
>     # which translates to /cygdrive/c/temp inside cygwin
>     # prepare input
>     TMPFILE=$TMPDIR/foo.$$
>     cat > "$TMPFILE" <<\EOF
>     some stuff
>     EOF
>     # call program: error: no such file /cygdrive/c/temp/foo.1234
>     # filename should be c:/temp/foo.1234
>     external_program "$TMPFILE"
> 
> Now TMPFILE is passed to the external program using POSIX path
> notation which it does not understand.
> 
> If possible I'd like to avoid using 'cygpath' in the script since it
> should run on different platforms.
> 

you may check if the cygpath usage is valid before do it:

is_CYGWIN=`uname | grep CYGWIN | wc -l`
if [ $is_CYGWIN -gt 0 ]
then
  TMPDIR=`cygpath -w $TMPDIR`
fi
# continue with your code here


regards

kf





--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]