BurntSushi / walkdir

Rust library for walking directories recursively.
The Unlicense
1.21k stars 106 forks source link

Walkdir doesn't work properly while using debugger #190

Closed AL4AL closed 8 months ago

AL4AL commented 8 months ago

rustc -V:

rustc 1.73.0 (cc66ad468 2023-10-03)

cat /etc/os-release:

VERSION="22.04.1 LTS (Jammy Jellyfish)"

vscode about:

Version: 1.84.0
Commit: d037ac076cee195194f93ce6fe2bdfe2969cc82d
Date: 2023-11-01T11:28:21.782Z
Electron: 25.9.2
ElectronBuildId: 24603566
Chromium: 114.0.5735.289
Node.js: 18.15.0
V8: 11.4.183.29-electron.0
OS: Linux x64 6.2.0-33-generic snap

rust-analyzer version:

v0.3.1722

CodeLLDB version:

v1.10.0

cat Cargo.toml:

[package]
******
******
edition = "2021"
[dependencies]
******
walkdir = "= 2.4.0"

My code:

    for entry in WalkDir::new(&base_path) {
        match entry {
            Ok(entry) => {
                println!("{}", entry.path().display());
            },
            Err(msg) => println!("{}", msg),
        }
    }

When I run this part of code using debugger everything works fine except entry always is Err and the message is this: IO error for operation on /home/admin/Documents: No such file or directory (os error 2) but when I run this very same code using cargo from my terminal or running executable files in target, it works fine and gives Ok for all entry_s At first I thought the problem is from debugger which somehow prevents access to my files, so I tried to open same file using std:fs:File and get it's content, and it worked perfectly even while launching with debugger

BurntSushi commented 8 months ago

This doesn't look like a problem with this crate. Sorry, but I don't know what the issue is.