forked from LBRYCommunity/lbry-sdk
fix Missing xdg download location
Fixes an error in detection xdg config locations when XDG_DOWNLOAD_DIR is not present in `user-dirs.dirs`
This commit is contained in:
parent
b7cb2a7aa5
commit
08197a327e
1 changed files with 4 additions and 3 deletions
|
@ -691,8 +691,9 @@ 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)
|
||||
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')
|
||||
|
|
Loading…
Reference in a new issue