Skip to content
Discussion options

You must be logged in to vote

Use a simply rust function to solve that:

fn is_dir(path: &str) -> Result<bool, String> {
    if let Ok(metadata) = fs::metadata(path) {
        Ok(metadata.is_dir())
    } else {
        Err("is_dir throw a error".to_string())
    }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by s3xysteak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant