if user has no Downloads dir on windows, use cwd

This commit is contained in:
Alex Grintsvayg 2019-09-09 15:29:54 -04:00 committed by Lex Berezhny
parent c2dae43965
commit ecc74e2ae5

View file

@ -630,9 +630,13 @@ class Config(CLIConfig):
def get_windows_directories() -> typing.Tuple[str, str, str]:
from lbry.winpaths import get_path, FOLDERID, UserHandle # pylint: disable=import-outside-toplevel
from lbry.winpaths import get_path, FOLDERID, UserHandle, \
PathNotFoundException # pylint: disable=import-outside-toplevel
download_dir = get_path(FOLDERID.Downloads, UserHandle.current)
try:
download_dir = get_path(FOLDERID.Downloads, UserHandle.current)
except PathNotFoundException:
download_dir = os.getcwd()
# old
appdata = get_path(FOLDERID.RoamingAppData, UserHandle.current)
@ -644,7 +648,6 @@ def get_windows_directories() -> typing.Tuple[str, str, str]:
# new
data_dir = user_data_dir('lbrynet', 'lbry')
lbryum_dir = user_data_dir('lbryum', 'lbry')
download_dir = get_path(FOLDERID.Downloads, UserHandle.current)
return data_dir, lbryum_dir, download_dir