summary refs log tree commit diff stats
path: root/tools/niminst
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-06-08 16:05:21 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-06-08 16:05:29 +0200
commitfb0df95015959f3174bde4001739ed98239cfc75 (patch)
treec785aa33d81b2ba41ec67ce3dbdc8b51a0e4f08c /tools/niminst
parenta2345702f8328e028bd1acd0c8812445b10272ea (diff)
downloadNim-fb0df95015959f3174bde4001739ed98239cfc75.tar.gz
fixes #4289
Diffstat (limited to 'tools/niminst')
-rw-r--r--tools/niminst/niminst.nim16
1 files changed, 8 insertions, 8 deletions
diff --git a/tools/niminst/niminst.nim b/tools/niminst/niminst.nim
index 8ff53bbe3..9f255e64b 100644
--- a/tools/niminst/niminst.nim
+++ b/tools/niminst/niminst.nim
@@ -202,35 +202,35 @@ proc parseCmdLine(c: var ConfigData) =
   if c.infile.len == 0: quit(Usage)
   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 html = if preventHtml: ".html" else: ""
+  let html = if not allowHtml: ".html" else: ""
   let explicit = splitPath(root).tail
   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,
-                        preventHtml: bool) =
+                        allowHtml: bool) =
   let tail = splitPath(root).tail
   if tail == "nimcache" or tail[0] == '.':
     return
-  let preventHtml = preventHtml or tail != "doc"
+  let allowHtml = allowHtml or tail == "doc"
   for k, f in walkDir(root):
     if f[0] == '.' and root[0] != '.':
       discard "skip .git directories etc"
     else:
       case k
       of pcFile, pcLinkToFile:
-        if not ignoreFile(f, root, preventHtml):
+        if not ignoreFile(f, root, allowHtml):
           add(s, unixToNativePath(f))
       of pcDir:
-        walkDirRecursively(s, f, preventHtml)
+        walkDirRecursively(s, f, allowHtml)
       of pcLinkToDir: discard
 
 proc addFiles(s: var seq[string], patterns: seq[string]) =
   for p in items(patterns):
     if existsDir(p):
-      walkDirRecursively(s, p, true)
+      walkDirRecursively(s, p, false)
     else:
       var i = 0
       for f in walkFiles(p):