[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fwd: Re: [Mingw-users] Autoconf MSYS_PREFIX_HACK

From: Keith Marshall
Subject: Re: Fwd: Re: [Mingw-users] Autoconf MSYS_PREFIX_HACK
Date: Wed, 30 Mar 2005 20:42:30 +0100

On Wednesday 30 March 2005 4:02 am, Bob Friesenhahn wrote:
> On Tue, 29 Mar 2005, Brian Dessent wrote:
> > For Cygwin at least, isn't it a lot easier to just do something like
> >
> > winpath="`cygpath -w "$unixpath"`"
> >
> > than mess around parsing the output of mount and such?
> Yes, but it doesn't work for MinGW (with the MSYS shell), and this
> solution works identically for both.

Indeed.  However, it is serious overkill.

In Cygwin, you *should* use cygpath, where you *really* need Win32 path 
semantics;  (mostly you don't, because Cygwin is designed to work with its 
own POSIX emulation layer, which handles the the translation for you, "on the 

As you point out, MSYS doesn't have cygpath, but you don't normally need 
it; `pwd -W' serves the purpose, although it *is* restricted to translating 
the dirname component of paths to directories which actually exist.

The last part of your script, i.e. the conversion of slashes to backslashes, 
is not only unnecessary, but is actually *less* robust than simply leaving 
the slashes as they are, (which eliminates any concern over what level of 
escaping you require).  Unless you are using some seriously inept software, 
which goes out of its way to misinterpret slashes in path names, the Win32 
BDOS will accept the slash and the backslash as equivalent -- indeed, this is 
equally true of all versions of MS-DOS since 2.00, (which was the first to 
support a hierarchical file system), and also of Win16, (which ran on top of 
MS-DOS in any case).

The only place where you *should* need to pay attention to the distinction 
between slash and backslash is when you are constructing a command line which 
is to be parsed by cmd.exe, (or, or one of the command line 
tools which emulates its CP/M style parsing conventions;  IMHO, such cases 
are best dealt with individually, each in its own context.

Notwithstanding the above, your script clearly works for you.  I may not 
agree that it is the best solution for dealing with Win32 paths, but I'm sure 
that will not dissuade you from continuing to use it.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]