Use get() instead of in for os.environ to also skip if the value is empty.
This commit is contained in:
parent
2f3705bb12
commit
b8ae0df0ae
@ -68,9 +68,9 @@ def _wrap_default(default):
|
|||||||
|
|
||||||
def _find_system_cache_dir() -> str:
|
def _find_system_cache_dir() -> str:
|
||||||
if os.name == 'posix':
|
if os.name == 'posix':
|
||||||
if 'XDG_CACHE_HOME' in os.environ:
|
if os.environ.get('XDG_CACHE_HOME'):
|
||||||
return os.environ['XDG_CACHE_HOME']
|
return os.environ['XDG_CACHE_HOME']
|
||||||
elif 'HOME' in os.environ:
|
elif os.environ.get('HOME'):
|
||||||
return os.path.join(os.environ['HOME'], '.cache')
|
return os.path.join(os.environ['HOME'], '.cache')
|
||||||
elif os.name == 'nt':
|
elif os.name == 'nt':
|
||||||
# TODO: just guessing
|
# TODO: just guessing
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user