Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions emrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -1144,19 +1144,15 @@ def is_exe(fpath):
if is_exe(program):
return program
else:
for path in os.environ["PATH"].split(os.pathsep):
exe_suffixes = ['']
if WINDOWS and '.' not in fname:
exe_suffixes = ['.exe', '.cmd', '.bat']
for path in os.environ['PATH'].split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file

if WINDOWS and '.' not in fname:
if is_exe(exe_file + '.exe'):
return exe_file + '.exe'
if is_exe(exe_file + '.cmd'):
return exe_file + '.cmd'
if is_exe(exe_file + '.bat'):
return exe_file + '.bat'
for ext in exe_suffixes:
if is_exe(exe_file + ext):
return exe_file + ext

return None

Expand Down