summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Bruhin <git@the-compiler.org>2014-09-19 17:25:15 +0200
committerFlorian Bruhin <git@the-compiler.org>2014-09-19 17:25:15 +0200
commit4e261d9993590e6c3cbb925e2a28a40cceac28c7 (patch)
treeff28c5210b2390e25e8916f4102b188b302ed9dd
parent749b0c7427c32c4b30613958c2f1e54d182effd2 (diff)
downloadjournalwatch-4e261d9993590e6c3cbb925e2a28a40cceac28c7.tar.gz
journalwatch-4e261d9993590e6c3cbb925e2a28a40cceac28c7.zip
Create XDG_DATA_HOME/XDG_CONFIG_HOME if they don't exist. Fixes #1.v0.2.1
-rwxr-xr-xjournalwatch.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/journalwatch.py b/journalwatch.py
index 3536c3d..d250289 100755
--- a/journalwatch.py
+++ b/journalwatch.py
@@ -318,10 +318,16 @@ def parse_config_files():
A (config, patterns) tuple.
"""
cfg = parse_args()
+ if not os.path.exists(XDG_DATA_HOME):
+ os.mkdir(XDG_DATA_HOME, mode=0o700)
+ if not os.path.exists(XDG_CONFIG_HOME):
+ os.mkdir(XDG_CONFIG_HOME, mode=0o700)
+
if not os.path.exists(CONFIG_DIR):
os.mkdir(CONFIG_DIR)
if not os.path.exists(DATA_DIR):
os.mkdir(DATA_DIR)
+
if not os.path.exists(CONFIG_FILE):
with open(CONFIG_FILE, 'w') as f:
f.write(DEFAULT_CONFIG)