commit a14a9f46996649dae1fb578b35c7a8ddf6d0025a
parent 1361c18fbdbe58e29e59f210ee95a708ec0f8788
Author: nolash <dev@holbrook.no>
Date: Sat, 17 Jul 2021 08:22:39 +0200
Handle missing resource dirs
Diffstat:
2 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/chaind/setup.py b/chaind/setup.py
@@ -9,6 +9,7 @@ from xdg.BaseDirectory import (
xdg_data_dirs,
get_runtime_dir,
load_first_config,
+ save_config_path,
)
@@ -27,14 +28,21 @@ class Environment:
base_config_dir = load_first_config('chaind')
self.runtime_dir = os.path.join(get_runtime_dir(), 'chaind')
self.data_dir = os.path.join(xdg_data_dirs[0], 'chaind')
- self.config_dir = env.get('CONFINI_DIR', os.path.join(base_config_dir))
+ self.config_dir = env.get('CONFINI_DIR', base_config_dir)
+ if self.config_dir == None:
+ save_config_path('chaind')
+ self.config_dir = load_first_config('chaind')
self.session_runtime_dir = os.path.join(self.runtime_dir, self.session)
if domain:
self.runtime_dir = os.path.join(self.runtime_dir, domain)
+ os.makedirs(self.runtime_dir, exist_ok=True)
self.data_dir = os.path.join(self.data_dir, domain)
+ os.makedirs(self.data_dir, exist_ok=True)
self.config_dir = os.path.join(self.config_dir, domain)
+ os.makedirs(self.config_dir, exist_ok=True)
self.session_runtime_dir = os.path.join(self.runtime_dir, self.session)
+ os.makedirs(self.session_runtime_dir, exist_ok=True)
@property
def session(self):
diff --git a/requirements.txt b/requirements.txt
@@ -1,5 +1,5 @@
-chainlib>0.0.4,<=0.0.5
-chainqueue>=0.0.3a1,<=.0.0.4
-chainsyncer>0.0.4a1,<=0.0.5
+chainlib>=0.0.5a4,<=0.0.5
+chainqueue>=0.0.3a1,<=0.0.3
+chainsyncer>=0.0.4a1,<=0.0.4
confini>=0.3.6rc3,<0.5.0
pyxdg~=0.26