Don't load dotfiles, or files with an extension other than .json

This commit is contained in:
Robert Miles 2019-10-23 14:02:56 -04:00
parent c991a9961b
commit 1d1174425b
1 changed files with 3 additions and 1 deletions

View File

@ -40,7 +40,9 @@ def populate():
if os.path.isdir(d):
for p in os.listdir(d):
rule = d + "/" + p
name = p.replace(".json", "")
name, ext = os.path.splitext(p)
if p.startswith(".") or ext not in (".json", ""): # dot file or not .json or extensionless
continue # skip file
# print(p, rule, name)
if p in DB:
DB[name].append(grammar(load_rules(rule)))