mapgen_rivers/settings.py
Gael-de-Sailly c33f2d9582 Python side: rework config system.
Load `terrain.conf` of the script directory by default.
Add a `terrain_higher.conf` for alternative terrain.
2020-11-14 12:19:40 +01:00

17 lines
367 B
Python

import os.path
def read_config_file(fname):
settings = {}
if not os.path.isfile(fname):
return settings
with open(fname, 'r') as f:
for line in f:
slist = line.split('=', 1)
if len(slist) >= 2:
prefix, suffix = slist
settings[prefix.strip()] = suffix.strip()
return settings