From c088963cf29069f72d51553f9bbd95a92501ec3e Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Fri, 11 Nov 2022 17:39:46 -0500 Subject: [PATCH] Always touch config file dir if dne --- piker/config.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/piker/config.py b/piker/config.py index c7a7acc9..cb250386 100644 --- a/piker/config.py +++ b/piker/config.py @@ -197,6 +197,9 @@ def load( ''' path = path or get_conf_path(conf_name) + if not os.path.isdir(_config_dir): + os.mkdir(_config_dir) + if not os.path.isfile(path): fn = _conf_fn_w_ext(conf_name) @@ -209,9 +212,9 @@ def load( # if one exists. if os.path.isfile(template): shutil.copyfile(template, path) - else: - with open(path, 'w'): - pass # touch + else: + with open(path, 'r'): + pass # touch it config = toml.load(path, **tomlkws) log.debug(f"Read config file {path}")