Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Issue with glob in thumbnail tutorial #104

Open
chrispickard opened this issue Dec 7, 2018 · 2 comments
Open

Issue with glob in thumbnail tutorial #104

chrispickard opened this issue Dec 7, 2018 · 2 comments
Labels
bug Something isn't working

Comments

@chrispickard
Copy link
Contributor

After I finished the thumbnail tutorial, I tried to test it and got this error

Error: No files match pattern `rust_memes/*`

After seeing that, I progressively commented out more code to get a minimal reproduction, and I was able to find that this block of code doesn't match anything

use quicli::prelude::*;

fn main() -> CliResult {
    let files = glob("src/*")?;
    println!("{:?}", files);
    Ok(())
}
~/dev/rust/thumbify master
❯ cargo run --
   Compiling thumbify v0.1.0 (/home/chris.pickard/dev/rust/thumbify)
    Finished dev [unoptimized + debuginfo] target(s) in 1.11s
     Running `target/debug/thumbify`
Error: No files match pattern `src/*`

Even though I clearly have matching files in my src/ directory

~/dev/rust/thumbify master
❯ ls src
main.rs

I'm sorry, I feel like I'm quite a thorn in your side at the moment

@killercup
Copy link
Owner

Hey, no worries, I'm very glad you open these issues! 0.4 contained an updated glob function, and I think there might be some issues with that. I'll try to investigate!

If you want to get this working without using quicli's glob, you can try to a use the glob crate directly (or another one that does the same), or play around with using std::fs::read_dir :)

@killercup killercup added the bug Something isn't working label Dec 7, 2018
@ibotty
Copy link

ibotty commented Jun 28, 2019

Hi!

It looks as if it's because of glob's max_depth(1) call. Removing allows the following (previously non-working) patterns with subdirectories ("dir/file", "*/file" and "**/file"). It does find files in subdirectories with simple patterns ("*.png") though, which it did not before.

It would be possible to add the max_depth call only when a '/' is in the pattern. What do you think?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants