DigitPaint / roger

Roger is your friendly front-end development toolbox!
MIT License
4 stars 4 forks source link

Resolve to file when dirname and filename conflict #58

Closed edwinvdgraaf closed 8 years ago

edwinvdgraaf commented 8 years ago

By convention resolving a directory like '/elements/' will resolve to the index.html in this directory => 'elements/index.html' when available. This is done by checking that the passed in name in find_template is a directory on the line altered in this commit. It does not take into account that this name can also be a file (when passed in without extension). This is an issue because most template render call work without extenstion and traverse this same code:

  <%= partial 'elements/footer' %>

This commits adds a check to verify that there is no file inside the parent directory with the same name.

flurin commented 8 years ago

How can this "also be a file" you specifically check for File.directory?(name).

edwinvdgraaf commented 8 years ago

Code does not take into account that this name can also be a file (when passed in without extension).

edwinvdgraaf commented 8 years ago

Updated the code with your suggestions, hoping its more clear now.