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

Find takes a path #15

Open
Michael-F-Bryan opened this issue Jun 7, 2017 · 2 comments
Open

Find takes a path #15

Michael-F-Bryan opened this issue Jun 7, 2017 · 2 comments

Comments

@Michael-F-Bryan
Copy link
Owner

At the moment, the Dir::find() function only checks to see if a file's name (everything after the last /) is the same as the specified string. In some situations you may want to provide a file path relative to the embedded directory's root (because of naming conflicts across dirs, etc).

Dir::find() should have a signature which takes anything which is AsRef<Path>.

@Boscop
Copy link

Boscop commented May 15, 2018

Yes, please!

My use case is: I want to serve a web app from a web server, the web app consists of multiple assets files which I want to embed into the exe using this crate. In the request handler I get a relative path, which I want to use to get the file from this embedded folder hierarchy.

Basically I want to do something like this but for actix and rocket:
https://github.com/maueki/embed_staticfile.rs

Btw, the docs on docs.rs don't include the Dir struct or any of its methods like find etc.
Please add it to the docs, and mention that the generated variable will be of type Dir :)

@Michael-F-Bryan
Copy link
Owner Author

Michael-F-Bryan commented Jun 8, 2018

I've pretty much rewritten this crate from scratch to use a true proc macro. The generated Dir type has both a get_file() method for fetching a resource based on its exact filename, as well as a generic find() method that uses globs and returns an iterator of DirEntries.

@Boscop if you have the time, could you look at the updated crate on docs.rs and let me know whether this works for you?

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

2 participants