When searching for programs, also take into account all possible

extensions for executables (only Windows is affected by this).


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@21201 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2007-10-25 13:40:28 +00:00
parent 8f2a8c7267
commit eab1d98ab4

View File

@ -158,17 +158,19 @@ def checkProg(description, progs, rc_entry = [], path = [], not_found = ''):
ac_word = ac_prog.split(' ')[0] ac_word = ac_prog.split(' ')[0]
print '+checking for "' + ac_word + '"... ', print '+checking for "' + ac_word + '"... ',
path = os.environ["PATH"].split(os.pathsep) + path path = os.environ["PATH"].split(os.pathsep) + path
extlist = ['']
if os.environ.has_key("PATHEXT"):
extlist = extlist + os.environ["PATHEXT"].split(os.pathsep)
for ac_dir in path: for ac_dir in path:
# check both ac_word and ac_word.exe (for windows system) for ext in extlist:
if os.path.isfile( os.path.join(ac_dir, ac_word) ) or \ if os.path.isfile( os.path.join(ac_dir, ac_word + ext) ):
os.path.isfile( os.path.join(ac_dir, ac_word + ".exe") ): print ' yes'
print ' yes' # write rc entries for this command
# write rc entries for this command if len(rc_entry) == 1:
if len(rc_entry) == 1: addToRC(rc_entry[0].replace('%%', ac_prog))
addToRC(rc_entry[0].replace('%%', ac_prog)) elif len(rc_entry) > 1:
elif len(rc_entry) > 1: addToRC(rc_entry[idx].replace('%%', ac_prog))
addToRC(rc_entry[idx].replace('%%', ac_prog)) return [ac_dir, ac_word]
return [ac_dir, ac_word]
# if not successful # if not successful
print ' no' print ' no'
# write rc entries for 'not found' # write rc entries for 'not found'