This commit is contained in:
parent
503dc22236
commit
9249276db0
2 changed files with 5 additions and 5 deletions
|
|
@ -60,7 +60,7 @@ proc raiseOSError*(errorCode: OSErrorCode; additionalInfo = "") {.noinline.} =
|
||||||
if additionalInfo.len == 0:
|
if additionalInfo.len == 0:
|
||||||
e.msg = osErrorMsg(errorCode)
|
e.msg = osErrorMsg(errorCode)
|
||||||
else:
|
else:
|
||||||
e.msg = osErrorMsg(errorCode) & "\nAdditional info: " & additionalInfo
|
e.msg = osErrorMsg(errorCode) & "\nAdditional info: '" & additionalInfo & "'"
|
||||||
if e.msg == "":
|
if e.msg == "":
|
||||||
e.msg = "unknown OS error"
|
e.msg = "unknown OS error"
|
||||||
raise e
|
raise e
|
||||||
|
|
|
||||||
|
|
@ -971,7 +971,7 @@ proc rawCreateDir(dir: string): bool =
|
||||||
elif errno in {EEXIST, ENOSYS}:
|
elif errno in {EEXIST, ENOSYS}:
|
||||||
result = false
|
result = false
|
||||||
else:
|
else:
|
||||||
raiseOSError(osLastError())
|
raiseOSError(osLastError(), dir)
|
||||||
elif defined(posix):
|
elif defined(posix):
|
||||||
let res = mkdir(dir, 0o777)
|
let res = mkdir(dir, 0o777)
|
||||||
if res == 0'i32:
|
if res == 0'i32:
|
||||||
|
|
@ -980,7 +980,7 @@ proc rawCreateDir(dir: string): bool =
|
||||||
result = false
|
result = false
|
||||||
else:
|
else:
|
||||||
#echo res
|
#echo res
|
||||||
raiseOSError(osLastError())
|
raiseOSError(osLastError(), dir)
|
||||||
else:
|
else:
|
||||||
when useWinUnicode:
|
when useWinUnicode:
|
||||||
wrapUnary(res, createDirectoryW, dir)
|
wrapUnary(res, createDirectoryW, dir)
|
||||||
|
|
@ -992,7 +992,7 @@ proc rawCreateDir(dir: string): bool =
|
||||||
elif getLastError() == 183'i32:
|
elif getLastError() == 183'i32:
|
||||||
result = false
|
result = false
|
||||||
else:
|
else:
|
||||||
raiseOSError(osLastError())
|
raiseOSError(osLastError(), dir)
|
||||||
|
|
||||||
proc existsOrCreateDir*(dir: string): bool {.rtl, extern: "nos$1",
|
proc existsOrCreateDir*(dir: string): bool {.rtl, extern: "nos$1",
|
||||||
tags: [WriteDirEffect, ReadDirEffect].} =
|
tags: [WriteDirEffect, ReadDirEffect].} =
|
||||||
|
|
@ -1005,7 +1005,7 @@ proc existsOrCreateDir*(dir: string): bool {.rtl, extern: "nos$1",
|
||||||
if result:
|
if result:
|
||||||
# path already exists - need to check that it is indeed a directory
|
# path already exists - need to check that it is indeed a directory
|
||||||
if not existsDir(dir):
|
if not existsDir(dir):
|
||||||
raise newException(IOError, "Failed to create the directory")
|
raise newException(IOError, "Failed to create '" & dir & "'")
|
||||||
|
|
||||||
proc createDir*(dir: string) {.rtl, extern: "nos$1",
|
proc createDir*(dir: string) {.rtl, extern: "nos$1",
|
||||||
tags: [WriteDirEffect, ReadDirEffect].} =
|
tags: [WriteDirEffect, ReadDirEffect].} =
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue