Please review pull request #706: Use expand_path to normalize paths in autoloader opened by (pcarlisle)
Description:
Just using Pathname#cleanpath didn't properly convert \ to / on windows. Using
both should give correct normalized paths.
- Opened: Tue Apr 24 20:30:28 UTC 2012
- Based on: puppetlabs:master (54e1c83afde1b721e5433adea17a4dd0caffbc63)
- Requested merge: pcarlisle:autoloader-windows (6ff239f2629fba51cc5732095fb48be7e5b1f189)
Diff follows:
diff --git a/lib/puppet/util/autoload.rb b/lib/puppet/util/autoload.rb
index ba4c639..3e8eb0b 100644
--- a/lib/puppet/util/autoload.rb
+++ b/lib/puppet/util/autoload.rb
@@ -93,7 +93,7 @@ def files_to_load(path)
end
def files_in_dir(dir, path)
- dir = Pathname.new(dir)
+ dir = Pathname.new(File.expand_path(dir))
Dir.glob(File.join(dir, path, "*.rb")).collect do |file|
Pathname.new(file).relative_path_from(dir).to_s
end
@@ -156,7 +156,7 @@ def search_directories(env=nil)
# Normalize a path. This converts ALT_SEPARATOR to SEPARATOR on Windows
# and eliminates unnecessary parts of a path.
def cleanpath(path)
- Pathname.new(path).cleanpath.to_s
+ Pathname.new(File.expand_path(path)).cleanpath.to_s
end
end
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
