summaryrefslogtreecommitdiffstats
path: root/gita/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'gita/common.py')
-rw-r--r--gita/common.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/gita/common.py b/gita/common.py
index ef3933d..abbef5f 100644
--- a/gita/common.py
+++ b/gita/common.py
@@ -1,16 +1,17 @@
import os
-def get_config_dir() -> str:
- parent = os.environ.get('XDG_CONFIG_HOME') or os.path.join(
- os.path.expanduser('~'), '.config')
- root = os.path.join(parent, "gita")
- return root
+def get_config_dir(root=None) -> str:
+ if root is None:
+ root = os.environ.get('XDG_CONFIG_HOME') or os.path.join(
+ os.path.expanduser('~'), '.config')
+ return os.path.join(root, "gita")
+ else:
+ return os.path.join(root, ".gita")
-def get_config_fname(fname: str) -> str:
+def get_config_fname(fname: str, root=None) -> str:
"""
Return the file name that stores the repo locations.
"""
- root = get_config_dir()
- return os.path.join(root, fname)
+ return os.path.join(get_config_dir(root), fname)