isaacs / isexe

Minimal module to check if a file is executable.
ISC License
48 stars 17 forks source link

Returns false when used in case-sensitive directory on Windows #22

Closed Gudahtt closed 6 years ago

Gudahtt commented 6 years ago

Windows now features per-directory case-sensitivity. This is explained here: https://blogs.msdn.microsoft.com/commandline/2018/02/28/per-directory-case-sensitivity-and-wsl/ A directory created in the Windows Subsystem for Linux will be case-sensitive by default.

As a result, the isexe check will always return false unless the file extension is in all-caps. This is because the file extensions obtained from the PathExt environment variable are in all-caps. This is not a great default behavior, because most file extensions are lower-case.

Edit: Nevermind; this library works fine. It converts both the path and the extension to lower-case. I was thinking of the step performed in the which library, which tries finding an executable by appending each extension found in PathExt to the command name until it finds one.