Let kitty_exe() raise an error message if kitty could not be found

This commit is contained in:
Luflosi 2020-07-31 15:39:56 +02:00
parent 7401c6ac97
commit db04c70d4a
No known key found for this signature in database
GPG Key ID: 4E41E29EDCC345D0

View File

@ -64,16 +64,16 @@ class WindowGeometry(NamedTuple):
def kitty_exe() -> str:
rpath = sys._xoptions.get('bundle_exe_dir')
if not rpath:
items = filter(None, os.environ.get('PATH', '').split(os.pathsep))
items = os.environ.get('PATH', '').split(os.pathsep) + [os.path.join(base, 'launcher')]
seen: Set[str] = set()
for candidate in items:
for candidate in filter(None, items):
if candidate not in seen:
seen.add(candidate)
if os.access(os.path.join(candidate, 'kitty'), os.X_OK):
rpath = candidate
break
else:
rpath = os.path.join(base, 'launcher')
raise SystemExit('kitty binary not found')
return os.path.join(rpath, 'kitty')