Make createDir more robust
Should now properly work for root directories on Windows (after isAbsolute is fixed)
This commit is contained in:
parent
45b432b901
commit
785e402247
1 changed files with 3 additions and 1 deletions
|
|
@ -1064,8 +1064,10 @@ proc createDir*(dir: string) {.rtl, extern: "nos$1", tags: [WriteDirEffect].} =
|
||||||
omitNext = false
|
omitNext = false
|
||||||
else:
|
else:
|
||||||
discard tryCreateDir(substr(dir, 0, i-1))
|
discard tryCreateDir(substr(dir, 0, i-1))
|
||||||
|
|
||||||
# The loop does not create the dir itself if it doesn't end in separator
|
# The loop does not create the dir itself if it doesn't end in separator
|
||||||
if dir[^1] notin {DirSep, AltSep}:
|
if dir.len > 0 and not omitNext and
|
||||||
|
dir[^1] notin {DirSep, AltSep}:
|
||||||
discard tryCreateDir(dir)
|
discard tryCreateDir(dir)
|
||||||
|
|
||||||
proc copyDir*(source, dest: string) {.rtl, extern: "nos$1",
|
proc copyDir*(source, dest: string) {.rtl, extern: "nos$1",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue