From 10bd0ba9d66a32cb8e0f7fb322843005b23181b7 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 13 Nov 2012 22:49:32 -0800 Subject: cleaned up logging, and much improved error message when file is not found --- lib/leap_cli/path.rb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'lib/leap_cli/path.rb') diff --git a/lib/leap_cli/path.rb b/lib/leap_cli/path.rb index 48b0d11..ed4e478 100644 --- a/lib/leap_cli/path.rb +++ b/lib/leap_cli/path.rb @@ -105,14 +105,14 @@ module LeapCli; module Path end # - # tries to find a file somewhere with 'filename', under a directory 'name' if possible. + # tries to find a file somewhere with 'filename' (which is probably in the form [node.name, filename]) # - def self.find_file(name, filename) + def self.find_file(filename) # named path? - if filename.is_a? Symbol - path = named_path([filename, name], platform_provider) + if filename.is_a? Array + path = named_path(filename, platform_provider) return path if File.exists?(path) - path = named_path([filename, name], provider) + path = named_path(filename, provider) return path if File.exists?(path) end @@ -162,6 +162,11 @@ module LeapCli; module Path File.exists?(named_path(name, provider_dir)) end + def self.relative_path(path) + path = named_path(path) + path.sub(/^#{Regexp.escape(provider)}\//,'') + end + private def self.find_in_directory_tree(filename) -- cgit v1.2.3