Useful filesystem queries for file permissions:
See functions
.
- is_executable
- is_readable
- is_writable
- is_removable
- is_creatable
This is expected to work with Windows
as well, but it was only tested in Unix
machines.
(PR welcome! Need someone to test it and update this section).
```rust use permissions::*;
fn main() -> std::io::Result<()> {
// Functions accept AsRef<Path>
assert!(isreadable("src/")?);
assert!(iswritable("src/")?);
assert!(iswritable("src/lib.rs")?);
assert!(isexecutable("/usr/bin/cat")?);
assert!(isremovable("src/lib.rs")?);
assert!(iscreatable("src/file.rs")?);
Ok(()) } ```
For this crate I plan on adding a nicer and convenient rwx
bitmask interface, in the 0.4 version.
If you're interested in this implemented, open an issue and I'll try to complete it sooner.
I haven't finished it yet beucase I've never needed this functionality, the existing functions were enough for my use cases.
(Part of the code for rwx
and (Owner | Group | Other)
permissions bitflags are already
available at the project's repository)
It's easy to contribute to this crate, here are some options: - Share it to a friend. - Help improve this README or other docs (even little details). - Open an issue or PR in the repository. - Use it and give feedback. - Suggest how to improve.