Little improvements in system dir detection

This commit is contained in:
Clement Lefebvre 2015-09-20 14:34:36 +01:00
parent 1a97c41458
commit 9c5b943fb1

View File

@ -110,13 +110,10 @@ def get_user_item_path():
return item_dir return item_dir
def get_system_item_paths(): def get_system_item_paths():
item_dirs = None item_dirs = []
if os.environ.has_key('XDG_DATA_DIRS'): if os.environ.has_key('XDG_DATA_DIRS'):
item_dirs = os.environ['XDG_DATA_DIRS'].split(":") item_dirs = os.environ['XDG_DATA_DIRS'].split(":")
else: item_dirs.append(os.path.join('/usr', 'share'))
item_dirs = [os.path.join('usr', 'share')]
return item_dirs return item_dirs
def rel_path(target, base=os.curdir): def rel_path(target, base=os.curdir):
@ -1228,12 +1225,10 @@ class pluginclass( object ):
def onPropsApp( self, menu, widget ): def onPropsApp( self, menu, widget ):
newFileFlag = False newFileFlag = False
sysPaths = get_system_item_paths() sysPaths = get_system_item_paths()
for path in sysPaths: for path in sysPaths:
path = os.path.join(path, "applications")
path += "applications"
relPath = os.path.relpath(widget.desktopFile, path) relPath = os.path.relpath(widget.desktopFile, path)