Skip to content

Commit 7cafe37

Browse files
authored
Simplify which helper. NFC (#1665)
1 parent 7b61f27 commit 7cafe37

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

emsdk.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,19 +237,16 @@ def is_exe(fpath):
237237
if is_exe(program):
238238
return program
239239
else:
240+
exe_suffixes = ['']
241+
if WINDOWS and '.' not in fname:
242+
exe_suffixes = ['.exe', '.cmd', '.bat']
243+
240244
for path in os.environ["PATH"].split(os.pathsep):
241245
path = path.strip('"')
242246
exe_file = os.path.join(path, program)
243-
if is_exe(exe_file):
244-
return exe_file
245-
246-
if WINDOWS and '.' not in fname:
247-
if is_exe(exe_file + '.exe'):
248-
return exe_file + '.exe'
249-
if is_exe(exe_file + '.cmd'):
250-
return exe_file + '.cmd'
251-
if is_exe(exe_file + '.bat'):
252-
return exe_file + '.bat'
247+
for ext in exe_suffixes:
248+
if is_exe(exe_file + ext):
249+
return exe_file + ext
253250

254251
return None
255252

0 commit comments

Comments
 (0)