fixes #4289
This commit is contained in:
parent
a2345702f8
commit
fb0df95015
1 changed files with 8 additions and 8 deletions
|
|
@ -202,35 +202,35 @@ proc parseCmdLine(c: var ConfigData) =
|
||||||
if c.infile.len == 0: quit(Usage)
|
if c.infile.len == 0: quit(Usage)
|
||||||
if c.mainfile.len == 0: c.mainfile = changeFileExt(c.infile, "nim")
|
if c.mainfile.len == 0: c.mainfile = changeFileExt(c.infile, "nim")
|
||||||
|
|
||||||
proc ignoreFile(f, root: string, preventHtml: bool): bool =
|
proc ignoreFile(f, root: string, allowHtml: bool): bool =
|
||||||
let (_, name, ext) = splitFile(f)
|
let (_, name, ext) = splitFile(f)
|
||||||
let html = if preventHtml: ".html" else: ""
|
let html = if not allowHtml: ".html" else: ""
|
||||||
let explicit = splitPath(root).tail
|
let explicit = splitPath(root).tail
|
||||||
result = (ext in ["", ".exe", ".idx"] or
|
result = (ext in ["", ".exe", ".idx"] or
|
||||||
ext == html or name[0] == '.') and f != explicit
|
ext == html or name[0] == '.') and name & ext != explicit
|
||||||
|
|
||||||
proc walkDirRecursively(s: var seq[string], root: string,
|
proc walkDirRecursively(s: var seq[string], root: string,
|
||||||
preventHtml: bool) =
|
allowHtml: bool) =
|
||||||
let tail = splitPath(root).tail
|
let tail = splitPath(root).tail
|
||||||
if tail == "nimcache" or tail[0] == '.':
|
if tail == "nimcache" or tail[0] == '.':
|
||||||
return
|
return
|
||||||
let preventHtml = preventHtml or tail != "doc"
|
let allowHtml = allowHtml or tail == "doc"
|
||||||
for k, f in walkDir(root):
|
for k, f in walkDir(root):
|
||||||
if f[0] == '.' and root[0] != '.':
|
if f[0] == '.' and root[0] != '.':
|
||||||
discard "skip .git directories etc"
|
discard "skip .git directories etc"
|
||||||
else:
|
else:
|
||||||
case k
|
case k
|
||||||
of pcFile, pcLinkToFile:
|
of pcFile, pcLinkToFile:
|
||||||
if not ignoreFile(f, root, preventHtml):
|
if not ignoreFile(f, root, allowHtml):
|
||||||
add(s, unixToNativePath(f))
|
add(s, unixToNativePath(f))
|
||||||
of pcDir:
|
of pcDir:
|
||||||
walkDirRecursively(s, f, preventHtml)
|
walkDirRecursively(s, f, allowHtml)
|
||||||
of pcLinkToDir: discard
|
of pcLinkToDir: discard
|
||||||
|
|
||||||
proc addFiles(s: var seq[string], patterns: seq[string]) =
|
proc addFiles(s: var seq[string], patterns: seq[string]) =
|
||||||
for p in items(patterns):
|
for p in items(patterns):
|
||||||
if existsDir(p):
|
if existsDir(p):
|
||||||
walkDirRecursively(s, p, true)
|
walkDirRecursively(s, p, false)
|
||||||
else:
|
else:
|
||||||
var i = 0
|
var i = 0
|
||||||
for f in walkFiles(p):
|
for f in walkFiles(p):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue