Skip to content

Commit 494900d

Browse files
committed
add env variable check
1 parent eadfc02 commit 494900d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tldr.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,10 @@ def get_cache_dir() -> Path:
9696

9797

9898
def get_system_cache_dir() -> Path:
99-
for entry in os.environ.get('XDG_DATA_DIRS').split(':'):
100-
if (Path(entry) / 'tldr').is_dir():
101-
return Path(entry) / 'tldr'
99+
if os.environ.get('XDG_DATA_DIRS', False):
100+
for entry in os.environ.get('XDG_DATA_DIRS').split(':'):
101+
if (Path(entry) / 'tldr').is_dir():
102+
return Path(entry) / 'tldr'
102103
return Path('/usr/share/tldr')
103104

104105

0 commit comments

Comments
 (0)