Make createDir more robust

Should now properly work for root directories on Windows (after isAbsolute
is fixed)
This commit is contained in:
Dmitry Polienko 2016-10-22 17:53:51 +07:00
commit 785e402247

View file

@ -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",