Skip to content

Add function PathExt::removable #3

Description

@marcospb19

In Unix, a file is removable if you have write access to the parent directory.

So you can write something like:

fn removable(path: AsRef<Path>) -> Result<bool> {
    match path.as_ref().parent() {
        Some(parent) => parent.writable(),
        None => Ok(false),
    }
}

Not sure about Windows tho, what do you think?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions