parent
90ed904c4d
commit
8f198db2ca
2 changed files with 13 additions and 1 deletions
|
|
@ -28,13 +28,16 @@ proc next*(it: var PathIter; x: string): (int, int) =
|
||||||
if not it.notFirst and x[it.i] in {DirSep, AltSep}:
|
if not it.notFirst and x[it.i] in {DirSep, AltSep}:
|
||||||
# absolute path:
|
# absolute path:
|
||||||
inc it.i
|
inc it.i
|
||||||
|
when doslikeFileSystem: # UNC paths have leading `\\`
|
||||||
|
if hasNext(it, x) and x[it.i] == DirSep and
|
||||||
|
it.i+1 < x.len and x[it.i+1] != DirSep:
|
||||||
|
inc it.i
|
||||||
else:
|
else:
|
||||||
while it.i < x.len and x[it.i] notin {DirSep, AltSep}: inc it.i
|
while it.i < x.len and x[it.i] notin {DirSep, AltSep}: inc it.i
|
||||||
if it.i > it.prev:
|
if it.i > it.prev:
|
||||||
result = (it.prev, it.i-1)
|
result = (it.prev, it.i-1)
|
||||||
elif hasNext(it, x):
|
elif hasNext(it, x):
|
||||||
result = next(it, x)
|
result = next(it, x)
|
||||||
|
|
||||||
# skip all separators:
|
# skip all separators:
|
||||||
while it.i < x.len and x[it.i] in {DirSep, AltSep}: inc it.i
|
while it.i < x.len and x[it.i] in {DirSep, AltSep}: inc it.i
|
||||||
it.notFirst = true
|
it.notFirst = true
|
||||||
|
|
|
||||||
9
tests/stdlib/tos_unc.nim
Normal file
9
tests/stdlib/tos_unc.nim
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
discard """
|
||||||
|
disabled: "posix"
|
||||||
|
"""
|
||||||
|
|
||||||
|
# bug 10952, UNC paths
|
||||||
|
import os
|
||||||
|
|
||||||
|
doAssert r"\\hostname\foo\bar" / "baz" == r"\\hostname\foo\bar\baz"
|
||||||
|
doAssert r"\\?\C:\foo" / "bar" == r"\\?\C:\foo\bar"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue