From 08197a327e6a0af802cdbec6fe8881de0560d6ee Mon Sep 17 00:00:00 2001 From: Noah Date: Mon, 13 Apr 2020 07:13:19 -0400 Subject: [PATCH] fix Missing xdg download location Fixes an error in detection xdg config locations when XDG_DOWNLOAD_DIR is not present in `user-dirs.dirs` --- lbry/conf.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lbry/conf.py b/lbry/conf.py index fa395d8a9..6e1081a91 100644 --- a/lbry/conf.py +++ b/lbry/conf.py @@ -691,9 +691,10 @@ def get_darwin_directories() -> typing.Tuple[str, str, str]: def get_linux_directories() -> typing.Tuple[str, str, str]: try: with open(os.path.join(user_config_dir(), 'user-dirs.dirs'), 'r') as xdg: - down_dir = re.search(r'XDG_DOWNLOAD_DIR=(.+)', xdg.read()).group(1) - down_dir = re.sub(r'\$HOME', os.getenv('HOME') or os.path.expanduser("~/"), down_dir) - download_dir = re.sub('\"', '', down_dir) + down_dir = re.search(r'XDG_DOWNLOAD_DIR=(.+)', xdg.read()) + if down_dir: + down_dir = re.sub(r'\$HOME', os.getenv('HOME') or os.path.expanduser("~/"), down_dir.group(1)) + download_dir = re.sub('\"', '', down_dir) except OSError: download_dir = os.getenv('XDG_DOWNLOAD_DIR') if not download_dir: