Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XDG_DATA_DIRS useage corrected (Fixes wrong site_data_dir e.g. under Kubuntu) #122

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions appdirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,20 +142,20 @@ def site_data_dir(appname=None, appauthor=None, version=None, multipath=False):
if appname:
path = os.path.join(path, appname)
else:
# XDG default for $XDG_DATA_DIRS
# only first, if multipath is False
path = os.getenv('XDG_DATA_DIRS',
os.pathsep.join(['/usr/local/share', '/usr/share']))
pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)]
# XDG default: $XDG_DATA_DIRS for searching through multiple directories,
# '/usr/local/share' for single application directory
# (for distribution independent files, also '/usr/share' could be used)
if multipath:
path = os.getenv('XDG_DATA_DIRS',
os.pathsep.join(['/usr/local/share', '/usr/share']))
pathlist = [os.path.expanduser(x.rstrip(os.sep)) for x in path.split(os.pathsep)]
else:
pathlist = ['/usr/local/share']
if appname:
if version:
appname = os.path.join(appname, version)
pathlist = [os.sep.join([x, appname]) for x in pathlist]

if multipath:
path = os.pathsep.join(pathlist)
else:
path = pathlist[0]
path = os.pathsep.join(pathlist)
return path

if appname and version:
Expand Down