lib/rabbit/theme/searcher.rb in rabbit-2.0.7 vs lib/rabbit/theme/searcher.rb in rabbit-2.0.8
- old
+ new
@@ -1,5 +1,7 @@
+require "pathname"
+
require 'rabbit/theme/entry'
module Rabbit
module Theme
module Searcher
@@ -80,19 +82,24 @@
found_entry
end
def find_file(target, themes=nil)
+ return target if absolute_path?(target)
themes ||= @theme_stack + @image_entries
found_entry = themes.find do |entry|
entry.have_file?(target)
end
if found_entry.nil?
names = themes.collect {|entry| entry.name}
raise LoadError,
"can't find file in themes #{names.inspect}: #{target}."
end
found_entry.full_path(target)
+ end
+
+ def absolute_path?(path)
+ Pathname.new(path).absolute?
end
def collect_all_theme(&block)
theme_names = {}
themes = []