This is the mail archive of the
mailing list for the Cygwin project.
RE: PATCH: getcwd() pathstyle
- To: "'Jason Gouger'" <cygwin at jason-gouger dot com>
- Subject: RE: PATCH: getcwd() pathstyle
- From: David Sainty <David dot Sainty at optimation dot co dot nz>
- Date: Fri, 12 Jan 2001 15:49:01 +1300
- Cc: cygwin-patches at cygwin dot com
> Unfortunately the "problem" would be across many scripts
> The scripts are all part of a common development environment
> which is used
> on both UNIX and NT. Under UNIX the scripts build options for gcc and
> compile the application. Under NT the same is true, except
> for the fact
> that the scripts drive MSDev compilers which require native
> win32 paths...
I can see the incentive, but I don't think it is the responsibility of
Cygwin to resolve this if it risks breaking the Unix-style interface that
Cygwin is attempting to provide.
The problem you are trying to solve is not (directly) "OS" related, but is
really related to the command you are using. The MS compilers require
filenames in a certain format, the Cygwin and Unix compilers require them in
a different format (although it just so happens that the Cygwin utilities
have a compatibility mode too).
You must agree that changing the output of getcwd() is not a general
solution. If you are calling programs from Cygwin that require non-Cygwin
pathnames, you will also potentially need to know the native DOS directory
delimiter to work with some utilities.
> Some examples assuming pathstyle=win32
> 1. User cd's to 'C:/cygwin' getcwd will return 'C:/cygwin'
> 2. User cd's to '/usr/local' getcwd will return '/usr/local'
> 3. User cd's to '//C/cygwin' getcwd will return '//C/cygwin'
> 4. User cd's to '/cygdrive/c/cygwin' getcwd will return
If this is the case, then your build scripts must still rely on you making
the "right" style of chdir() in order for it to work. That is fairly
The general solution (although not convenient) is to use 'cygpath.exe'
within your scripts, or wrap the non-Cygwin utilities in scripts that
provide the appropriate abstraction layer.
The latter is probably the cleanest, and will always work correctly. ...and
is also the most work :)
But it has never been easy getting the same scripts to work under Windows
and Unix, it only seems that way if you have Cygwin :)