delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/06/04/13:58:33

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
X-envelope-info: <rschulz AT sonic DOT net>
Message-Id: <5.2.1.1.2.20030604104926.02ed71b0@pop.sonic.net>
X-Sender: rschulz AT pop DOT sonic DOT net
Date: Wed, 04 Jun 2003 10:58:23 -0700
To: cygwin AT cygwin DOT com
From: Randall R Schulz <rschulz AT sonic DOT net>
Subject: Re: rsync and cygwin paths
In-Reply-To: <Pine.GSO.4.44.0306041340510.25752-100000@slinky.cs.nyu.edu
>
References: <5 DOT 2 DOT 1 DOT 1 DOT 2 DOT 20030604102619 DOT 02ed4598 AT pop DOT sonic DOT net>
Mime-Version: 1.0

At 10:44 2003-06-04, Igor Pechtchanski wrote:
>On Wed, 4 Jun 2003, Randall R Schulz wrote:
>
> > At 10:06 2003-06-04, Igor Pechtchanski wrote:
> > >On Wed, 4 Jun 2003, Lapo Luchini wrote:
> > >
> > > > ...
> > > >
> > > > http://cygwin.com/cygwin-ug-net/using-utils.html#CYGPATH
> > > >
> > > > NEWARGS=""
> > > > for arg in $@ ;
> > > > do
> > > >   if [ -e "${arg}" ]; then
> > > >     NEWARGS="${NEWARGS} `cygpath -p -w "$arg"`"
> > > >   else
> > > >     NEWARGS="${NEWARGS} $arg"
> > > >   fi
> > > > done
> > >
> > >Lapo,
> > >
> > >Note that the above won't work correctly if the program is expected to
> > >create the file with a given name...  IMO, there is no way of writing a
> > >generic wrapper script without knowing anything about program parameters.
> > >     Igor
> >
> >
> > Igor,
> >
> > Strictly speaking, that's true. Certainly Lapo's script fragment is too
> > simple-minded to work in any kind of general setting.
> >
> > However for many purposes it's feasible to write some simple-minded
> > heuristics that make the determination about when and how to apply
> > "cygpath." I currently use a BASH script that uses a simple "case"
> > statement to paper over the Cygwin / Windows interface for invoking the
> > Java 2 SDK tools. The case statement's glob patterns detect whether any
> > given argument is (probably) a file name or PATH-like entity and then
> > applies cygpath as necessary. It can be fooled, of course, but in
> > practice it works fine for me.
> >
> > Randall Schulz
>
>Randall,
>
>I agree, Java is not too hard.  I believe I've posted the wrapper script
>that I used at one point or another.  Certainly the parameters to Java
>itself can be recognized exactly.  It's also easy enough to decide that
>anything in the program arguments with a '/' in it is a filename, and
>convert it accordingly.  WFM (tm).
>I was talking about the general case, for an unknown Win32 application.
>     Igor


Igor,

While I mostly only use my wrapper for Java, there's no specific 
knowledge of the Java SDK tools built into it (there are 26 of them!). 
The only time I've seen it mess up is when I use an argument to 
"javadoc" with the English construct "and / or" (or, more likely, the 
computer term "I/O"), the forward slash gets changed to a backslash.

This is pretty much the only kind of problem you're likely to get into 
with a generic approach. Things that can be construed as Cygwin file 
names but are not get inappropriately transformed, of course. One can 
always refine the pattern detection in the wrapper script if necessary.

WFM? Of course. What else matters??

Randall Schulz 


--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019