Update parsecfg.nim

Value includes double quotation marks.
This commit is contained in:
lihf8515
2016-11-02 11:48:11 +08:00
committed by GitHub
parent 9a1c87d6bf
commit 89d4574445

View File

@@ -512,10 +512,16 @@ proc writeConfig*(dict: Config, filename: string) =
kv = key
if value != "": ## If the key is not empty
if not allCharsInSet(value, SymChars):
kv.add(segmentChar)
kv.add("\"")
kv.add(replace(value))
kv.add("\"")
if find(value, '"') == -1:
kv.add(segmentChar)
kv.add("\"")
kv.add(replace(value))
kv.add("\"")
else:
kv.add(segmentChar)
kv.add("\"\"\"")
kv.add(replace(value))
kv.add("\"\"\"")
else:
kv.add(segmentChar)
kv.add(value)