From ddfc61a72de6773922fe4a9405893bf03cf6079b Mon Sep 17 00:00:00 2001 From: Akio Taniguchi Date: Tue, 23 Apr 2019 17:48:15 +0900 Subject: [PATCH] :+1: Add custom wradex directory feature --- wradex/constants.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wradex/constants.py b/wradex/constants.py index 49c9fb4..5d89aaf 100644 --- a/wradex/constants.py +++ b/wradex/constants.py @@ -7,12 +7,18 @@ ] # standard library +import os from pathlib import Path # dependent packages import wradex # local constants -WRADEX_DIR = Path('~', '.wradex').expanduser() +if 'WRADEX_DIR' in os.environ: + path = os.environ.get('WRADEX_DIR') + WRADEX_DIR = Path(path).expanduser() +else: + WRADEX_DIR = Path.home() / '.wradex' + WRADEX_CONFIG = Path(WRADEX_DIR, 'config.yaml') _WRADEX_CONFIG = Path(*wradex.__path__, 'data', 'config.yaml')