Merge branch 'fix-macos-system-paths-when-no-perms' of https://github.com/amarshall/kitty

This commit is contained in:
Kovid Goyal 2025-04-23 05:42:24 +05:30
commit 2839eab5e4
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -670,7 +670,7 @@ def system_paths_on_macos() -> tuple[str, ...]:
def add_from_file(x: str) -> None:
try:
f = open(x)
except FileNotFoundError:
except (FileNotFoundError, PermissionError):
return
with f:
for line in f:
@ -681,7 +681,7 @@ def add_from_file(x: str) -> None:
entries.append(line)
try:
files = os.listdir('/etc/paths.d')
except FileNotFoundError:
except (FileNotFoundError, PermissionError):
files = []
for name in sorted(files):
add_from_file(os.path.join('/etc/paths.d', name))