summaryrefslogtreecommitdiffstats
path: root/gd_diff.py
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2016-11-13 01:14:09 +0000
committerrsiddharth <s@ricketyspace.net>2016-11-13 01:14:09 +0000
commitba6981811e863e9929db87533a88b8ead52f9369 (patch)
treecd638bae40e8b6b4a1490f1463c598bc7143f204 /gd_diff.py
parent61a47f6da59efc6369edb6c8562f663bc4c0333d (diff)
Update `config_dir` function.
Now creates the config directory if it is not already created. * gd_diff.py (config_dir): Update function. * tests/test_gd_diff.py (test_config_dir): Update test. (test_configured_p_yes): Update test.
Diffstat (limited to 'gd_diff.py')
-rw-r--r--gd_diff.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/gd_diff.py b/gd_diff.py
index fccc557..384e92f 100644
--- a/gd_diff.py
+++ b/gd_diff.py
@@ -212,7 +212,17 @@ def slurp_fields_from_readme(content):
def config_dir():
- return os.path.join(os.getenv('HOME'), '.config', 'gns-deb-diff')
+ """Return the gns-deb-diff config directory.
+
+ As a side effect, the directory is created if it does not exist.
+
+ """
+ cd = os.path.join(os.getenv('HOME'), '.config', 'gns-deb-diff')
+
+ if not os.path.isdir(cd):
+ os.makedirs(cd)
+
+ return cd
def config_file():