Fix instant preview on windows when dvipng is not available.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@36545 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Enrico Forestieri 2010-11-28 01:22:36 +00:00
parent 912fc37ec4
commit 4feb6cf62b

View File

@ -60,19 +60,20 @@ def make_texcolor(hexcolor, graphics):
def find_exe(candidates, path): def find_exe(candidates, path):
extlist = ['']
if os.environ.has_key("PATHEXT"):
extlist = extlist + os.environ["PATHEXT"].split(os.pathsep)
for prog in candidates: for prog in candidates:
for directory in path: for directory in path:
if os.name == "nt": for ext in extlist:
full_path = os.path.join(directory, prog + ".exe") full_path = os.path.join(directory, prog + ext)
else: if os.access(full_path, os.X_OK):
full_path = os.path.join(directory, prog) # The thing is in the PATH already (or we wouldn't
# have found it). Return just the basename to avoid
if os.access(full_path, os.X_OK): # problems when the path to the executable contains
# The thing is in the PATH already (or we wouldn't # spaces.
# have found it). Return just the basename to avoid return os.path.basename(full_path)
# problems when the path to the executable contains
# spaces.
return os.path.basename(full_path)
return None return None