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

DirectorySource path handling is unexpected #23

Closed
viraptor opened this issue Dec 24, 2015 · 9 comments
Closed

DirectorySource path handling is unexpected #23

viraptor opened this issue Dec 24, 2015 · 9 comments
Labels

Comments

@viraptor
Copy link
Contributor

DirectorySource treats the path argument in a very literal way. Specifically if there's a file "templates/index.hbs", then

DirectorySource::new("templates", ".hbs")

will register template "/index", but

DirectorySource::new("templates/", ".hbs")

will register template "index". I'd expect both to do the same thing (without initial slash), because the path points at the exact same directory.

@viraptor
Copy link
Contributor Author

This is also a regression from the previous API. Found when migrating older code.

@sunng87 sunng87 added the bug label Dec 24, 2015
@sunng87
Copy link
Owner

sunng87 commented Dec 24, 2015

Thanks for figuring out this issue. I will look into it later.

@untitaker
Copy link
Contributor

I'd recommend abandoning string-based prefix filtering and using Path throughout the whole impl instead.

On 24 December 2015 10:13:27 CET, Ning Sun notifications@github.com wrote:

Thanks for figuring out this issue. I will look into it later.


Reply to this email directly or view it on GitHub:
#23 (comment)

Sent from my phone. Please excuse my brevity.

@sunng87
Copy link
Owner

sunng87 commented Dec 24, 2015

Until last time I looked into std::path, some key apis like relative_from, prefix were still unstable.

@untitaker
Copy link
Contributor

a.relative_from(b) is b.join(a). Not sure what you need prefix for.

I'd like to try this if you give me a few days. I'm currently busy.

On 24 December 2015 11:35:15 CET, Ning Sun notifications@github.com wrote:

Until last time I looked into std::path, some key apis like
relative_from, prefix were still unstable.


Reply to this email directly or view it on GitHub:
#23 (comment)

Sent from my phone. Please excuse my brevity.

@sunng87
Copy link
Owner

sunng87 commented Dec 25, 2015

Thanks Markus, then I will leave this to you.

I'm getting something with higher priority too.

On 12/24/2015 07:04 PM, Markus Unterwaditzer wrote:

a.relative_from(b) is b.join(a). Not sure what you need prefix for.

I'd like to try this if you give me a few days. I'm currently busy.

On 24 December 2015 11:35:15 CET, Ning Sun notifications@github.com wrote:

Until last time I looked into std::path, some key apis like
relative_from, prefix were still unstable.


Reply to this email directly or view it on GitHub:
#23 (comment)

Sent from my phone. Please excuse my brevity.


Reply to this email directly or view it on GitHub
#23 (comment).

sunng87 added a commit that referenced this issue Dec 25, 2015
@sunng87
Copy link
Owner

sunng87 commented Dec 25, 2015

@untitaker, this issue is fixed by @viraptor via #24. I will close this for now. If you were going to refactor the DirectorySource, feel free to reopen it or send a pull request.

Thank you @viraptor @untitaker for tracking this issue and using this module!

@sunng87 sunng87 closed this as completed Dec 25, 2015
@viraptor
Copy link
Contributor Author

Merry christmas :)

@sunng87
Copy link
Owner

sunng87 commented Dec 25, 2015

Merry Christmas and Happy new Year!

On 12/25/2015 02:01 PM, Stanisław Pitucha wrote:

Merry christmas :)


Reply to this email directly or view it on GitHub
#23 (comment).

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

No branches or pull requests

3 participants