mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-11-05 15:00:30 +03:00
make sure config exists before writing to it
This commit is contained in:
parent
de1afc3c7e
commit
feadc6a565
1 changed files with 4 additions and 1 deletions
|
|
@ -2314,7 +2314,10 @@ def write_to_config(thisconfig, key, value=None, config_file=None):
|
|||
value = thisconfig[origkey] if origkey in thisconfig else thisconfig[key]
|
||||
cfg = config_file if config_file else 'config.py'
|
||||
|
||||
# load config file
|
||||
# load config file, create one if it doesn't exist
|
||||
if not os.path.exists(cfg):
|
||||
os.mknod(cfg)
|
||||
logging.info("Creating empty " + cfg)
|
||||
with open(cfg, 'r', encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue