Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit a83556b

Browse files
committed
Work around Nim bug in 0.15.2 and older
1 parent 8bc4835 commit a83556b

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

tempfile.nim

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,10 @@ proc mkdtemp*(prefix = "tmp", suffix = "", dir = ""): string =
6262
# A bit racy, but better than nothing
6363
if not path.existsDir:
6464
createDir(path)
65-
return path
65+
# In Nim 0.15.2 and older `createDir` didn't fail if `path`
66+
# did already exist, but was not a directory.
67+
if path.existsDir:
68+
return path
6669
except:
6770
discard
6871
raise newException(IOError, "Unable to create temporary directory")

0 commit comments

Comments
 (0)