fitzgen / is_executable

Is there an executable file at the given path?
Apache License 2.0
19 stars 9 forks source link

Try and determine executability using file extension on Windows #6

Closed alpha-tango-kilo closed 3 years ago

alpha-tango-kilo commented 3 years ago

Will close #5.

Adds additional logic using the example given in the above issue to check the file's extension to determine if it is executable, as this is the main way Windows does this. Should the file not have an extension (or the environment variable not be fetched successfully), the original method is used.

This fixes some files being falsely reported as not being executable, such as .bat files. A test has been added for this.

The only unpatched gap here is files with no extension that are scripts and such, like .bat files. Though at this point it becomes more of an issue with how Windows determines executability than the crate.

Given this changes the crate's behaviour, a version bump may be advisable if this is merged.

Let me know if any changes are needed!