forked from LBRYCommunity/lbry-sdk
fix config error if $HOME is None
-not seen on travis due to HOME being manually set to /tmp
This commit is contained in:
parent
80440fd6bd
commit
77ece96356
1 changed files with 2 additions and 3 deletions
|
@ -507,11 +507,10 @@ 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('\$HOME', os.getenv('HOME'), down_dir)
|
||||
download_dir = re.sub('\"', '', down_dir)
|
||||
down_dir = re.sub('\$HOME', os.getenv('HOME') or os.path.expanduser("~/"), down_dir)
|
||||
download_dir = re.sub('\"', '', down_dir)
|
||||
except EnvironmentError:
|
||||
download_dir = os.getenv('XDG_DOWNLOAD_DIR')
|
||||
|
||||
if not download_dir:
|
||||
download_dir = os.path.expanduser('~/Downloads')
|
||||
|
||||
|
|
Loading…
Reference in a new issue