is_executable
Is there an executable file at the given path?
A small helper function which determines whether or not the given path points to
an executable file. If there is no file at the given path, or the file is not
executable, then false
is returned. When there is a file and the file is
executable, then true
is returend.
Answering this question is OS specific: some operating systems (Windows) do not
distinguish between executable and non-executable file permissions. On such
OSes, if there is a file at the given path, then true
is returned.
The API comes in two flavors:
-
An extension trait to add an
is_executable
method onstd::path::Path
andstd::fs::Permissions
:use IsExecutable; use fs; use Path; let path = new; // Determine if `path` is executable. if path.is_executable else // Determine if some `std::fs::Metadata`'s `std::fs::Permissions` are // executable. # let _foo = ;
-
For convenience, a standalone
is_executable
function, which takes anyAsRef<Path>
:use is_executable; use Path; let path = new; if is_executable else
License: Apache-2.0/MIT