From 07ad27b583acfa5c8529fc1ae92ec7f4495bb782 Mon Sep 17 00:00:00 2001 From: Tanguy Ortolo Date: Sun, 24 Jul 2011 21:16:36 +0200 Subject: [PATCH] Let autojump follow the XDG Base Directory Spec. It now uses $AUTOJUMP_HOME if set, else $XDG_DATA_HOME/autojump if set, else ~/.local/share/autojump. --- autojump | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/autojump b/autojump index 7a2702d..2e321da 100755 --- a/autojump +++ b/autojump @@ -34,7 +34,11 @@ import os MAX_KEYWEIGHT = 1000 MAX_STORED_PATHS = 600 COMPLETION_SEPARATOR = '__' -CONFIG_DIR = os.environ.get("AUTOJUMP_DATA_DIR", os.path.expanduser("~")) +if "AUTOJUMP_DATA_DIR" in os.environ: + CONFIG_DIR = os.environ.get("AUTOJUMP_DATA_DIR") +else: + xdg_data_dir = os.environ.get('XDG_DATA_HOME') or os.path.join(os.environ['HOME'], '.local', 'share') + CONFIG_DIR=os.path.join(xdg_data_dir, 'autojump') def uniqadd(collection, key): """Adds a key to a list only if it is not already present"""