discuss-gnustep
[Top][All Lists]
Advanced

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

Path issues on Win32


From: Stephen Brandon
Subject: Path issues on Win32
Date: Thu, 11 Oct 2001 12:55:04 +0100

Hi,

I'm having some trouble with paths on Win32/cygwin/mingw. In
particular at the moment, with make_services, but I am sure
that the issues run much deeper than this utility.

The problems begin when make_services decides it wants to
write something to the path "/home/Administrator/GNUstep/Services".
It complains that it cannot create the path, which implies
also that it had tried to find it and had decided that it
wasn't there.

If I force make_services.m to use
@"d:/home/Administrator/GNUstep/Services" or
@"d:\\home\\Administrator..." then it seems to do the trick
properly.

Therefore it seems that GNUstep's NSFileManager
implementation doesn't seem to know what to do with file
paths without drive letters.

A wee look at NSFileManager.m reveals... for absolute paths
without drive letter, the CYGWIN_HOME env var is consulted
and prepended, then "/" are replaced with "\".
Unfortunately, current versions of cygwin no longer set this
env var, thus these paths no longer work.

GNUstep without CYGWIN reliance

Since cygwin no longer sets CYGWIN_HOME, we must find
another way to determine where absolute paths refer to.

(a) should absolute paths be relative to the current drive,
as determined by NSFileManager:currentDirectoryPath?

(b) perhaps they should be relative to the SYSTEMDRIVE env
var (usually "C:")

(c) perhaps $PATH should be searched for references to
*cygwin/bin, and a drive letter determined from that

(d) $HOMEDRIVE and $HOMEPATH env vars (seem to default to
"C:" and "\"

(e) look at GNUSTEP* env vars and determine drive from them
somehow (I now use d:/- prepended GNUSTEP-* env vars instead
of /cygwin/* ones to prevent all confusion). Unfortunately
these env vars are only likely to be set if someone has
entered a shell (eg cygwin shell) and has a cygwin and
GNUstep environment set up. Fair enough for some... but I
want the apps to work without relying on this.

Personally I dislike the cygwin style //c/ and /cygwin/
paths, because they rely so heavily on cygwin being there,
and it gets really confusing at times to work out which
utilities/apps will interpret them in the intended manner.
That's why I have moved to using c:/ style paths in my
GNUSTEP_*_ROOT env vars.

In any case, I want the apps and programs I am working on to
work on machines without cygwin - that's why I am using
MinGW on top of cygwin, to remove the cygwin dependency.

Therefore I'd like to suggest:

(a) the use of the Windows 2k (and perhaps NT and previous?)
$USERPROFILE env var for determining Win32 home directory,
rather than cygwin's /home/username (which ends up as
/cygdrive/d/home/username on my setup). This should then
make GNUstep play nicely with Windows "profiles". This is
also a move away from the $HOMEPATH and $HOMEDRIVE values
currently used for mingw compilation of NSUser.m. Perhaps
$USERPROFILE could be checked first, and if non-existant,
then $HOMEPATH and $HOMEDRIVE are used?

(b) that absolute paths without drive letters should be made
relative to either the current drive (ie look at current
directory) or $SYSTEMDRIVE. Suggestions please?

I would value discussion on these points so I can patch
NSUser.m and NSFileManager.m and move on.

Cheers,
Stephen Brandon
stephen@brandonitconsulting.co.uk



reply via email to

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