summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkali <kali@leap.se>2013-01-25 07:23:04 +0900
committerkali <kali@leap.se>2013-01-25 07:23:04 +0900
commit74fb141d33b195a425f3eece63fdd7bcc0b970ab (patch)
tree51ca9e8fa8375e5b996bcec7818b5db3e88799be
parente16d462c4eb24bfc3866e65184ac0b77f5baeb16 (diff)
parenta1d880f201c914777daa8f416d5c25ab03e5b05d (diff)
Merge branch 'feature/dirspec' into develop
Conflicts: pkg/requirements.pip
-rw-r--r--pkg/requirements.pip1
-rw-r--r--src/leap/base/config.py18
2 files changed, 10 insertions, 9 deletions
diff --git a/pkg/requirements.pip b/pkg/requirements.pip
index a8a50fd3..0b0aef26 100644
--- a/pkg/requirements.pip
+++ b/pkg/requirements.pip
@@ -13,6 +13,7 @@ keyring
python-dateutil
sh
pygeoip # optional
+dirspec
# soledad deps -- will move to its own repo soon
python-gnupg
diff --git a/src/leap/base/config.py b/src/leap/base/config.py
index 9583a46a..e2f0beba 100644
--- a/src/leap/base/config.py
+++ b/src/leap/base/config.py
@@ -4,6 +4,7 @@ Configuration Base Class
import grp
import json
import logging
+import re
import socket
import time
import os
@@ -11,6 +12,7 @@ import os
logger = logging.getLogger(name=__name__)
from dateutil import parser as dateparser
+from dirspec import basedir
import requests
from leap.base import exceptions
@@ -279,15 +281,13 @@ def get_config_dir():
@rparam: config path
@rtype: string
"""
- # TODO
- # check for $XDG_CONFIG_HOME var?
- # get a more sensible path for win/mac
- # kclair: opinion? ^^
-
- return os.path.expanduser(
- os.path.join('~',
- '.config',
- 'leap'))
+ home = os.path.expanduser("~")
+ if re.findall("leap_tests-[a-zA-Z0-9]{6}", home):
+ # we're inside a test! :)
+ return os.path.join(home, ".config/leap")
+ else:
+ return os.path.join(basedir.default_config_home,
+ 'leap')
def get_config_file(filename, folder=None):