make matching case insensitive

This commit is contained in:
Adam Sanderson 2011-01-01 14:15:54 -07:00
parent ec37f3b59f
commit f933f9e674
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ module Qwandry
def scan(pattern) def scan(pattern)
results = [] results = []
all_paths.select do |path| all_paths.select do |path|
if File.fnmatch?(pattern, File.basename(path)) if File.fnmatch?(pattern, File.basename(path), File::FNM_CASEFOLD)
results << package(File.basename(path), [path]) results << package(File.basename(path), [path])
end end
end end

View File

@ -14,7 +14,7 @@ module Qwandry
results = Hash.new{|h,k| h[k] = package(k)} results = Hash.new{|h,k| h[k] = package(k)}
all_paths.select do |path| all_paths.select do |path|
basename = File.basename(path) basename = File.basename(path)
if File.fnmatch?(pattern, basename) if File.fnmatch?(pattern, basename, File::FNM_CASEFOLD)
# strip any file extension # strip any file extension
basename.sub! /\.\w+$/,'' unless File.directory?(path) basename.sub! /\.\w+$/,'' unless File.directory?(path)
results[basename].paths << path results[basename].paths << path