简体   繁体   中英

Checking Permissions of components of a path in Rust

I have a path to a file with multiple / characters separating the path components. Is there any way I can check the permissions of each directory and the file with <std::path::Components as core::iter::traits::iterator::Iterator>::next ?

Path components aren't Path s themselves. You are likely looking for std::path::Path.ancestors() . You can iterate over those and check their metadata()?.permissions().mode() as you like.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM