summaryrefslogtreecommitdiff
path: root/lib/chef/util
diff options
context:
space:
mode:
Diffstat (limited to 'lib/chef/util')
-rw-r--r--lib/chef/util/path_helper.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/chef/util/path_helper.rb b/lib/chef/util/path_helper.rb
index 8ca8279593..26c9c76fe5 100644
--- a/lib/chef/util/path_helper.rb
+++ b/lib/chef/util/path_helper.rb
@@ -141,6 +141,10 @@ class Chef
path = cleanpath(join(*parts))
path.gsub(/[\\\{\}\[\]\*\?]/) { |x| "\\"+x }
end
+
+ def self.relative_path_from(from, to)
+ pathname = Pathname.new(Chef::Util::PathHelper.cleanpath(to)).relative_path_from(Pathname.new(Chef::Util::PathHelper.cleanpath(from)))
+ end
end
end
end