aboutsummaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorNitroretro <nitroretro@protonmail.com>2019-12-17 19:45:11 +0200
committerLukas Fleischer <lfleischer@calcurse.org>2019-12-23 13:16:39 -0500
commitd85691ebee26891547c208e3e2e34e67b07562d7 (patch)
tree340d8d601f98776bd7570a0c9771e00e390df9e4 /contrib
parent19d2d9229e62ea5e993b462f0cdedd868ec6c2d9 (diff)
downloadcalcurse-d85691ebee26891547c208e3e2e34e67b07562d7.tar.gz
calcurse-d85691ebee26891547c208e3e2e34e67b07562d7.zip
calcurse-caldav: use $XDG_{CONFIG,DATA}_HOME
Signed-off-by: Lukas Fleischer <lfleischer@calcurse.org>
Diffstat (limited to 'contrib')
-rwxr-xr-xcontrib/caldav/calcurse-caldav.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/contrib/caldav/calcurse-caldav.py b/contrib/caldav/calcurse-caldav.py
index d247f80..ec8f8fb 100755
--- a/contrib/caldav/calcurse-caldav.py
+++ b/contrib/caldav/calcurse-caldav.py
@@ -519,11 +519,21 @@ def run_hook(name):
nsmap = {"D": "DAV:", "C": "urn:ietf:params:xml:ns:caldav"}
# Initialize default values.
-configfn = os.path.expanduser("~/.calcurse/caldav/config")
-lockfn = os.path.expanduser("~/.calcurse/caldav/lock")
-syncdbfn = os.path.expanduser("~/.calcurse/caldav/sync.db")
-hookdir = os.path.expanduser("~/.calcurse/caldav/hooks/")
-oauth_file = os.path.expanduser("~/.calcurse/caldav/oauth2_cred")
+if os.path.isdir(os.path.expanduser("~/.calcurse")):
+ configfn = os.path.expanduser("~/.calcurse/caldav/config")
+ lockfn = os.path.expanduser("~/.calcurse/caldav/lock")
+ syncdbfn = os.path.expanduser("~/.calcurse/caldav/sync.db")
+ hookdir = os.path.expanduser("~/.calcurse/caldav/hooks/")
+ oauth_file = os.path.expanduser("~/.calcurse/caldav/oauth2_cred")
+else:
+ calcurse_data = os.getenv("XDG_DATA_HOME", os.path.expanduser("~/.local/share")) + "/calcurse"
+ calcurse_config = os.getenv("XDG_CONFIG_HOME", os.path.expanduser("~/.local/share")) + "/calcurse"
+
+ configfn = os.path.expanduser(calcurse_config + "/caldav/config")
+ lockfn = os.path.expanduser(calcurse_data + "/caldav/lock")
+ syncdbfn = os.path.expanduser(calcurse_data + "/caldav/sync.db")
+ hookdir = os.path.expanduser(calcurse_config + "/caldav/hooks/")
+ oauth_file = os.path.expanduser(calcurse_config + "/caldav/oauth2_cred")
# Parse command line arguments.
parser = argparse.ArgumentParser('calcurse-caldav')