Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Included directories are added as files #52

Open
ghost opened this issue May 12, 2020 · 1 comment
Open

Included directories are added as files #52

ghost opened this issue May 12, 2020 · 1 comment

Comments

@ghost
Copy link

ghost commented May 12, 2020

When this code runs, every entry (including subdirectories) of the included Dir are returned as files.

    let entries = dir.find("**").expect("Failed to find entries (pattern error  )");
    for e in entries {
        if e.path().is_dir() {
            println!("{:?} is a directory!", e.path().display());
        } else {
            println!("{:?} is a file!", e.path().display());
        }
    }
@ghost
Copy link
Author

ghost commented May 12, 2020

I'm not sure if this is working as expected. The workaround is to use dir.get_dir:

 let entries = dir.find("**").expect("Failed to find entries (pattern error  )");
    for e in entries {
        if dir.get_dir(e.path()).is_some() {
            println!("{:?} is a directory!", e.path().display());
        } else {
            println!("{:?} is a file!", e.path().display());
        }
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants