File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed
Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change 1+ 2023-07-26 Frederik Seiffert <frederik@algoriddim.com>
2+
3+ * Source/NSURL.m:
4+ Fix NSURL path on Windows for network paths like \\xxx.
5+
162023-07-25 Frederik Seiffert <frederik@algoriddim.com>
27
38 * Headers/Foundation/NSFileManager.h:
Original file line number Diff line number Diff line change @@ -1497,24 +1497,24 @@ - (char*) _path: (char*)buf withEscapes: (BOOL)withEscapes
14971497 }
14981498
14991499#if defined(_WIN32)
1500- /* On windows a file URL path may be of the form C:\xxx (ie we should
1501- * not insert the leading slash) .
1500+ /* On Windows a file URL path may be of the form C:\xxx or \\xxx,
1501+ * and in both cases we should not insert the leading slash.
15021502 * Also the vertical bar symbol may have been used instead of the
15031503 * colon, so we need to convert that.
15041504 */
15051505 if (myData->isFile == YES )
15061506 {
1507- if (ptr[1 ] && isalpha (ptr[1 ]))
1508- {
1509- if (ptr[2 ] == ' : ' || ptr[2 ] == ' | ' )
1510- {
1511- if (ptr[ 3 ] == ' \0 ' || ptr[3 ] == ' / ' || ptr[ 3 ] == ' \\ ' )
1512- {
1513- ptr[ 2 ] = ' : ' ;
1514- ptr++;
1515- }
1516- }
1517- }
1507+ if (( ptr[1 ] && isalpha (ptr[1 ]))
1508+ && (ptr[ 2 ] == ' : ' || ptr[ 2 ] == ' | ' )
1509+ && (ptr[3 ] == ' \0 ' || ptr[3 ] == ' / ' || ptr[ 3 ] == ' \\ ' ) )
1510+ {
1511+ ptr[2 ] = ' : ' ;
1512+ ptr++; // remove leading slash
1513+ }
1514+ else if ( ptr[ 1 ] == ' \\ ' && ptr[ 2 ] == ' \\ ' )
1515+ {
1516+ ptr++; // remove leading slash
1517+ }
15181518 }
15191519#endif
15201520 return ptr;
You can’t perform that action at this time.
0 commit comments