BurntSushi/walkdir

Error from reading a directory without permission doesn't give path

开放

#126 创建于 2019年7月26日

 (2 条评论) (1 个反应) (0 位负责人)Rust (125 个派生)github user discovery
help wantedquestion

仓库指标

星标
 (1,504 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

When iterating over the WalkDir dictionary in Windows 10, rust stable 1.36, if the user does not have permission to read a directory, an error is given, but not the actual path. When hitting an error with files, the path in the error is displayed but not with directories for some reason:

Error on entry 'Err(Error { depth: 2, inner: Io { path: None, err: Os { code: 5, kind: PermissionDenied, message: "Access is denied." } } })': Error { depth: 2, inner: Io { path: None, err: Os { code: 5, kind: PermissionDenied, message: "Access is denied." } } }

    for entry in WalkDir::new(some_path){
        prepath = match &entry {
            Ok(path) => { 
                path
            }
            Err(err) => {
                println!("Error on entry '{:?}': {:?}", entry, err);             
                continue
            }
        };

贡献者指南