Windows fixup

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@28285 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2009-05-16 10:34:22 +00:00
parent 1b0355833f
commit 19743b8c0b
2 changed files with 30 additions and 1 deletions

View file

@ -1,3 +1,9 @@
2009-05-16 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSURL.m: Add support for file URLs on mswindows. The path
may be of the form C:\... rather than /... (and the colon might be
a vertical bar).
2009-05-11 Adam Fedor <fedor@gnu.org>
* Source/NSXMLParser.m: Fix include location

View file

@ -1412,6 +1412,7 @@ static unsigned urlAlign;
unsigned int len = (_baseURL ? strlen(baseData->path) : 0)
+ strlen(myData->path) + 3;
char buf[len];
char *ptr = buf;
char *tmp = buf;
if (myData->pathIsAbsolute == YES)
@ -1457,7 +1458,29 @@ static unsigned urlAlign;
{
*tmp = '\0';
}
path = [NSString stringWithUTF8String: buf];
#if defined(__MINGW32__)
/* On windows a file URL path may be of the form C:\xxx (ie we should
* not insert the leading slash).
* Also the vertical bar symbol may have been used instead of the
* colon, so we need to convert that.
*/
if (myData->isFile == YES)
{
if (ptr[1] && isalpha(ptr[1]))
{
if (ptr[2] == ':' || ptr[2] == '|')
{
if (ptr[3] == '\0' || ptr[3] == '/' || ptr[3] == '\\')
{
ptr[2] = ':';
ptr++;
}
}
}
}
#endif
path = [NSString stringWithUTF8String: ptr];
}
return path;
}