Closed lucieleblanc closed 2 weeks ago
The documentation states that is_executable returns true if there is a file at the given path and it is executable, and returns false otherwise.
true
false
However, on Windows, is_executable doesn't check that the path points to an actual file if the extension looks correct.
To see this in action, pass in any non-existent path ending in ".exe":
use is_executable::is_executable; use std::path::PathBuf; fn main() { println!("{}", is_executable(PathBuf::from("C:\\nonexistent.exe"))); }
Even though the file nonexistent.exe doesn't exist, the program only checks that the string ends in a valid extension and prints:
nonexistent.exe
(is_executable version: 1.0.1)
The documentation states that is_executable returns
true
if there is a file at the given path and it is executable, and returnsfalse
otherwise.However, on Windows, is_executable doesn't check that the path points to an actual file if the extension looks correct.
To see this in action, pass in any non-existent path ending in ".exe":
Even though the file
nonexistent.exe
doesn't exist, the program only checks that the string ends in a valid extension and prints:(is_executable version: 1.0.1)