Fixes #1406
This commit is contained in:
Kovid Goyal 2019-02-23 15:31:57 +05:30
commit 27ffed5a1a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -24,11 +24,14 @@ def kitty_exe():
if ans is None: if ans is None:
rpath = getattr(sys, 'bundle_exe_dir', None) rpath = getattr(sys, 'bundle_exe_dir', None)
if not rpath: if not rpath:
items = frozenset(os.environ['PATH'].split(os.pathsep)) items = os.environ['PATH'].split(os.pathsep)
seen = set()
for candidate in items: for candidate in items:
if os.access(os.path.join(candidate, 'kitty'), os.X_OK): if candidate not in seen:
rpath = candidate seen.add(candidate)
break if os.access(os.path.join(candidate, 'kitty'), os.X_OK):
rpath = candidate
break
else: else:
rpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'launcher') rpath = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'launcher')
ans = kitty_exe.ans = os.path.join(rpath, 'kitty') ans = kitty_exe.ans = os.path.join(rpath, 'kitty')