Merge pull request #2914 from StripedMonkey/SM-Config-patch
use home directory if xdg directory not found (Linux)
This commit is contained in:
commit
6a991e5c15
2 changed files with 5 additions and 4 deletions
2
Makefile
2
Makefile
|
@ -8,7 +8,7 @@ install:
|
||||||
pip install -e .
|
pip install -e .
|
||||||
|
|
||||||
tools:
|
tools:
|
||||||
pip install mypy==0.701
|
pip install mypy==0.701 pylint==2.4.4
|
||||||
pip install coverage astroid pylint
|
pip install coverage astroid pylint
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
|
|
|
@ -691,8 +691,9 @@ def get_darwin_directories() -> typing.Tuple[str, str, str]:
|
||||||
def get_linux_directories() -> typing.Tuple[str, str, str]:
|
def get_linux_directories() -> typing.Tuple[str, str, str]:
|
||||||
try:
|
try:
|
||||||
with open(os.path.join(user_config_dir(), 'user-dirs.dirs'), 'r') as xdg:
|
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.search(r'XDG_DOWNLOAD_DIR=(.+)', xdg.read())
|
||||||
down_dir = re.sub(r'\$HOME', os.getenv('HOME') or os.path.expanduser("~/"), down_dir)
|
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)
|
download_dir = re.sub('\"', '', down_dir)
|
||||||
except OSError:
|
except OSError:
|
||||||
download_dir = os.getenv('XDG_DOWNLOAD_DIR')
|
download_dir = os.getenv('XDG_DOWNLOAD_DIR')
|
||||||
|
|
Loading…
Reference in a new issue