Fix for mingw

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@10413 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2001-07-11 09:30:06 +00:00
parent 4581178e4d
commit c4bc0471b7
2 changed files with 31 additions and 8 deletions

View file

@ -1,7 +1,13 @@
2001-07-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSFileManager.m: ([fileSystemRepresentationWithPath:])
MINGW fix contributed by Michael Scheibler
2001-07-10 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: Update date/time designations to arrays
* Source/NSDate.m: Update to use date/time designation arrays.
2001-07-09 Richard Frith-Macdonald <rfm@gnu.org>
* Source/objc-load.m: Remove bogus include of objc-load.h

View file

@ -1280,15 +1280,32 @@ static NSFileManager* defaultManager = nil;
- (const char*) fileSystemRepresentationWithPath: (NSString*)path
{
#ifdef __MINGW__
/* If path is in Unix format, transmorgrify it so Windows functions
can handle it */
NSString *newpath = path;
const char *c_path = [path cString];
if (c_path[0] == '/' && c_path[1] == '/' && isalpha(c_path[2]))
/*
* If path is in Unix format, transmorgrify it so Windows functions
* can handle it
*/
NSString *newpath = path;
const char *c_path = [path cString];
int len = [path length];
if (c_path == 0)
{
/* Cygwin "//c/" type absolute path */
newpath = [NSString stringWithFormat: @"%c:%s", c_path[2], &c_path[3]];
newpath = [newpath stringByReplacingString: @"/" withString: @"\\"];
return 0;
}
if (len >= 3 && c_path[0] == '/' && c_path[1] == '/' && isalpha(c_path[2]))
{
if (len == 3 || c_path[3] == '/')
{
/* Cygwin "//c/" type absolute path */
newpath = [NSString stringWithFormat: @"%c:%s", c_path[2],
&c_path[3]];
newpath = [newpath stringByReplacingString: @"/" withString: @"\\"];
}
else
{
/* Windows absolute UNC path "//name/" */
newpath = [newpath stringByReplacingString: @"/" withString: @"\\"];
}
}
else if (isalpha(c_path[0]) && c_path[1] == ':')
{