Bug 865216 - Recognize exacutables on WINNT in is_executable. r=glandium

This commit is contained in:
Jacek Caban 2013-04-25 10:02:37 +02:00
parent 974e336c36
commit 67c9de8826

View File

@ -62,19 +62,19 @@ def is_executable(path):
'''
Return whether a given file path points to an executable or a library,
where an executable or library is identified by:
- the file extension on OS/2
- the file extension on OS/2 and WINNT
- the file signature on OS/X and ELF systems (GNU/Linux, Android, BSD,
Solaris)
As this function is intended for use to choose between the ExecutableFile
and File classes in FileFinder, and choosing ExecutableFile only matters
on OS/2, OS/X and ELF systems, we don't bother detecting other kind of
executables.
on OS/2, OS/X, ELF and WINNT (in GCC build) systems, we don't bother
detecting other kind of executables.
'''
if not os.path.exists(path):
return False
if substs['OS_ARCH'] == 'OS2':
if substs['OS_ARCH'] == 'OS2' or substs['OS_ARCH'] == 'WINNT':
return path.lower().endswith((substs['DLL_SUFFIX'],
substs['BIN_SUFFIX']))