Skip to content

Commit

Permalink
use fnmatch to test for case insensitive file systems
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed May 9, 2014
1 parent 20d5ebf commit 727ae97
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions actionview/lib/action_view/template/resolver.rb
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,10 @@ def find_templates(name, prefix, partial, details)
def query(path, details, formats)
query = build_query(path, details)

# deals with case-insensitive file systems.
sanitizer = Hash.new { |h,dir| h[dir] = Dir["#{dir}/*"] }

template_paths = Dir[query].reject { |filename|
File.directory?(filename) ||
!sanitizer[File.dirname(filename)].include?(filename)
# deals with case-insensitive file systems.
!File.fnmatch(query, filename, File::FNM_EXTGLOB)
}

template_paths.map { |template|
Expand Down

1 comment on commit 727ae97

@arthurnn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

File::FNM_EXTGLOB wont work on 1.9.3 =(

Please sign in to comment.