Method: Chef::ChefFS::FileSystem.resolve_path
- Defined in:
- lib/chef/chef_fs/file_system.rb
.resolve_path(entry, path) ⇒ Object
Resolve the given path against the entry, returning the entry at the end of the path.
Attributes
-
entry- the entry to start looking under. Relative paths will be resolved from here. -
path- the path to resolve. If it starts with/, the path will be resolved starting fromentry.root.
Examples
Chef::ChefFS::FileSystem.resolve_path(root_path, 'cookbooks/java/recipes/default.rb')
73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/chef/chef_fs/file_system.rb', line 73 def self.resolve_path(entry, path) return entry if path.length == 0 return resolve_path(entry.root, path) if path[0,1] == "/" && entry.root != entry if path[0,1] == "/" path = path[1,path.length-1] end result = entry Chef::ChefFS::PathUtils::split(path).each do |part| result = result.child(part) end result end |