Skip to content

Commit

Permalink
Put autojump's files in its own directory if $XDG_DATA_HOME is set.
Browse files Browse the repository at this point in the history
  • Loading branch information
wting committed Oct 5, 2017
1 parent b06d686 commit 6a529f4
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions bin/autojump
Original file line number Diff line number Diff line change
Expand Up @@ -75,29 +75,20 @@ def set_defaults():
config = {}

if is_osx():
data_home = os.path.join(
os.path.expanduser('~'),
'Library',
'autojump',
)
data_home = os.path.join(os.path.expanduser('~'), 'Library')
elif is_windows():
data_home = os.path.join(
os.getenv('APPDATA'),
'autojump',
)
data_home = os.getenv('APPDATA')
else:
data_home = os.getenv(
'XDG_DATA_HOME',
os.path.join(
os.path.expanduser('~'),
'.local',
'share',
'autojump',
),
)

config['data_path'] = os.path.join(data_home, 'autojump.txt')
config['backup_path'] = os.path.join(data_home, 'autojump.txt.bak')
config['data_path'] = os.path.join(data_home, 'autojump', 'autojump.txt')
config['backup_path'] = os.path.join(data_home, 'autojump', 'autojump.txt.bak')

return config

Expand Down

0 comments on commit 6a529f4

Please sign in to comment.