8 releases (4 breaking)
0.5.1 | Sep 4, 2023 |
---|---|
0.4.1 | Nov 18, 2022 |
0.3.0 |
|
0.2.1 |
|
0.0.1 | Sep 22, 2020 |
#437 in Filesystem
1,787 downloads per month
Used in 9 crates
(6 directly)
13KB
72 lines
NOTE
If you want Windows support, check faccess instead.
permissions
Useful filesystem queries for file permissions:
See functions
.
is_executable
is_readable
is_writable
is_removable
is_creatable
access_syscall
supports a custom bitfield of permissions.
Examples:
use permissions::*;
fn main() -> std::io::Result<()> {
// Functions accept `AsRef<Path>`
assert!(is_readable("src/")?);
assert!(is_writable("src/")?);
assert!(is_writable("src/lib.rs")?);
assert!(is_executable("/usr/bin/cat")?);
assert!(is_removable("src/lib.rs")?);
assert!(is_creatable("src/file.rs")?);
Ok(())
}
Alternatives
- faccess - it provides Windows support and a trait-based API.
Dependencies
~44KB