1
0
mirror of https://github.com/wting/autojump synced 2024-10-27 20:34:07 +00:00

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.
This commit is contained in:
Tanguy Ortolo 2011-07-24 21:16:36 +02:00
parent a45d94167f
commit 07ad27b583

View File

@ -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"""