Make sure the test snippet directory exists
This commit is contained in:
parent
e98bd3aceb
commit
9031c8fb0f
1 changed files with 7 additions and 5 deletions
|
|
@ -149,14 +149,16 @@ proc newDocumentor*(filename: AbsoluteFile; cache: IdentCache; conf: ConfigRef,
|
||||||
if filename.len == 0:
|
if filename.len == 0:
|
||||||
inc(d.id)
|
inc(d.id)
|
||||||
let nameOnly = splitFile(d.filename).name
|
let nameOnly = splitFile(d.filename).name
|
||||||
let subdir = getNimcacheDir(conf) / RelativeDir(nameOnly)
|
outp = getNimcacheDir(conf) / RelativeDir(nameOnly) /
|
||||||
createDir(subdir)
|
RelativeFile(nameOnly & "_snippet_" & $d.id & ".nim")
|
||||||
outp = subdir / RelativeFile(nameOnly & "_snippet_" & $d.id & ".nim")
|
|
||||||
elif isAbsolute(filename):
|
elif isAbsolute(filename):
|
||||||
outp = AbsoluteFile filename
|
outp = AbsoluteFile(filename)
|
||||||
else:
|
else:
|
||||||
# Nim's convention: every path is relative to the file it was written in:
|
# Nim's convention: every path is relative to the file it was written in:
|
||||||
outp = splitFile(d.filename).dir.AbsoluteDir / RelativeFile(filename)
|
let nameOnly = splitFile(d.filename).name
|
||||||
|
outp = AbsoluteDir(nameOnly) / RelativeFile(filename)
|
||||||
|
# Make sure the destination directory exists
|
||||||
|
createDir(outp.splitFile.dir)
|
||||||
# Include the current file if we're parsing a nim file
|
# Include the current file if we're parsing a nim file
|
||||||
let importStmt = if d.isPureRst: "" else: "import \"$1\"\n" % [d.filename]
|
let importStmt = if d.isPureRst: "" else: "import \"$1\"\n" % [d.filename]
|
||||||
writeFile(outp, importStmt & content)
|
writeFile(outp, importStmt & content)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue