gnustep-dev
[Top][All Lists]

## Re: Installation on windows (fwd)

 From: Jeremy Bettis Subject: Re: Installation on windows (fwd) Date: Wed, 16 Mar 2005 13:38:44 -0600



----- Original Message ----- From: "Richard Frith-Macdonald" <address@hidden>
To: "David Ayers" <address@hidden>
Sent: Wednesday, March 16, 2005 9:50 AM
Subject: Re: Installation on windows (fwd)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2005-03-16 15:28:25 +0000 David Ayers <address@hidden> wrote:


The first paragraph was talking about the implicit conversion that OPENSTEP for NT does. It would allow things like:

[@"test" writeToFile: @"C:\\Temp/test.txt" atomically: YES];
s = [NSString stringWithContentsOfFile: @"C:/Temp\\test.txt"];


I don't know whether we currently also support this on cygwin/msys/mingw but this has lead to real confusion and down right problems with some versions of OPENSTEP (or WebObjects) that didn't always handle it correctly.

We don't support it ... but I think the examples you provide would work.
The reason being ... we expect paths to be in posix format internally and
convert to windows native format at the point when we do a file operation.

In both cases, those strings look like relative posix path names containing
a single separator ...
so 'C:\Temp/test.txt' would get the '/' converted to '\' and end up as
'C:\Temp\test.txt' in the windows native format, and 'C:/Temp\text.txt'

would similarly end up as 'C:\Temp\text.txt' at the point where it is passed
to the windows system call to write or read the file.

However, -lastPathComponent would return 'test.txt' for the first string and
'Temp\test.txt' for the second string as these are assumed to be posix
paths.
Perhaps OPENSTEP did the same thing?




I can tell you from experience what OPENSTEP did. Methods like writeToFile: didn't touch the filename at all. Remember windows doesn't care which way the slashes go, so fopen("c:\\temp\\text.txt", "r") is EXACTLY the same as fopen("c:/temp/text.txt", "r") is EXACTLY the same as fopen("c:\\temp/text.txt", "r"). And lastPathComponent would return the part of the string after either / or \.


So [@"c:/temp\\text.txt" lastPathComponent] returned @"text.txt" and [@"c:\\temp/text.txt" lastPathComponent] returned @"text.txt" also.


And I wish gnustep worked the same way.