From d2406f33cdbbcb23fcf371cd7f028bd4dbfde1f6 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Thu, 15 May 2014 01:31:30 +0300 Subject: [PATCH] Fix $XDG_DATA_DIRS None problem --- youtube_dl_gui/Utils.py | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/youtube_dl_gui/Utils.py b/youtube_dl_gui/Utils.py index 897782e..726e43d 100644 --- a/youtube_dl_gui/Utils.py +++ b/youtube_dl_gui/Utils.py @@ -155,12 +155,13 @@ def get_icon_path(): ICONS_LIST = [ICON_NAME + s + ICON_EXTENSION for s in SIZES] - # Package path backwards 2 times - # e.g. /home/user/test/t1/t2 + # Package path backwards 3 times + # e.g. /home/user/test/t1/t2/t3 + # /home/user/test/t1/t2/t3/icons # /home/user/test/t1/t2/icons - # /home/user/test/t1/icons + # /home/user/tet/t1/icons path = abs_path(__file__) - for i in range(2): + for i in range(3): temp_path = fix_path(path) + 'icons' for icon in ICONS_LIST: @@ -193,17 +194,18 @@ def get_icon_path(): # $XDG_DATA_DIRS/icons path = os.getenv('XDG_DATA_DIRS') - for temp_path in path.split(':'): - temp_path = fix_path(temp_path) + 'icons' - temp_path = fix_path(temp_path) + 'hicolor' - - for size in SIZES: - p = fix_path(temp_path) + size - p = fix_path(p) + 'apps' - p = fix_path(p) + ICON_NAME + size + ICON_EXTENSION - - if file_exist(p): - return p + if path is not None: + for temp_path in path.split(':'): + temp_path = fix_path(temp_path) + 'icons' + temp_path = fix_path(temp_path) + 'hicolor' + + for size in SIZES: + p = fix_path(temp_path) + size + p = fix_path(p) + 'apps' + p = fix_path(p) + ICON_NAME + size + ICON_EXTENSION + + if file_exist(p): + return p # /usr/share/pixmaps path = '/usr/share/pixmaps/'