mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-30 08:21:25 +00:00
Fix NSURL path on Windows for UNC paths
This commit is contained in:
parent
f0e33a48d5
commit
48c8a1a6a1
3 changed files with 29 additions and 13 deletions
|
@ -1497,24 +1497,24 @@ static NSUInteger urlAlign;
|
|||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* On windows a file URL path may be of the form C:\xxx (ie we should
|
||||
* not insert the leading slash).
|
||||
/* On Windows a file URL path may be of the form C:\xxx or \\xxx,
|
||||
* and in both cases 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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((ptr[1] && isalpha(ptr[1]))
|
||||
&& (ptr[2] == ':' || ptr[2] == '|')
|
||||
&& (ptr[3] == '\0' || ptr[3] == '/' || ptr[3] == '\\'))
|
||||
{
|
||||
ptr[2] = ':';
|
||||
ptr++; // remove leading slash
|
||||
}
|
||||
else if (ptr[1] == '\\' && ptr[2] == '\\')
|
||||
{
|
||||
ptr++; // remove leading slash
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return ptr;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue