Skip to content
Snippets Groups Projects
Commit d7923419 authored by Pavel Kácha's avatar Pavel Kácha
Browse files

Allow for JavaScript "//" comments in configuration - better for

syntax highlighting. :) (deja-vu)
parent d66020b8
No related branches found
No related tags found
No related merge requests found
...@@ -430,5 +430,5 @@ class Client(object): ...@@ -430,5 +430,5 @@ class Client(object):
def read_cfg(cfgfile): def read_cfg(cfgfile):
abspath = path.join(path.dirname(__file__), cfgfile) abspath = path.join(path.dirname(__file__), cfgfile)
with open(abspath, "r") as f: with open(abspath, "r") as f:
stripcomments = "\n".join((l for l in f if not l.lstrip().startswith("#", "//"))) stripcomments = "\n".join((l for l in f if not l.lstrip().startswith(("#", "//"))))
return json.loads(stripcomments) return json.loads(stripcomments)
...@@ -879,7 +879,7 @@ def read_ini(path): ...@@ -879,7 +879,7 @@ def read_ini(path):
def read_cfg(path): def read_cfg(path):
with open(path, "r") as f: with open(path, "r") as f:
stripcomments = "\n".join((l for l in f if not l.lstrip().startswith("#"))) stripcomments = "\n".join((l for l in f if not l.lstrip().startswith(("#", "//"))))
conf = json.loads(stripcomments) conf = json.loads(stripcomments)
# Lowercase keys # Lowercase keys
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment