Method: Liquid::LocalFileSystem#full_path

Defined in:
lib/liquid/file_system.rb

#full_path(template_path) ⇒ Object

Raises:



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/liquid/file_system.rb', line 48

def full_path(template_path)
  raise FileSystemError, "Illegal template name '#{template_path}'" unless template_path =~ /^[^.\/][a-zA-Z0-9_\/]+$/
  
  full_path = if template_path.include?('/')
    File.join(root, File.dirname(template_path), "_#{File.basename(template_path)}.liquid")
  else
    File.join(root, "_#{template_path}.liquid")
  end
  
  raise FileSystemError, "Illegal template path '#{File.expand_path(full_path)}'" unless File.expand_path(full_path) =~ /^#{File.expand_path(root)}/
  
  full_path
end