fix a stack trace when trying to loadpath a non-existant directory

git-svn-id: file:///home/svn/framework3/trunk@11714 4d416f70-5f16-0410-b530-b9f4589650da
unstable
James Lee 2011-02-04 20:53:08 +00:00
parent 19c8673346
commit b05fd2c9a3
1 changed files with 5 additions and 3 deletions

View File

@ -605,16 +605,18 @@ class ModuleManager < ModuleSet
path.sub!(/#{File::SEPARATOR}$/, '')
# Make the path completely canonical
path = File.expand_path(path)
path = Pathname.new(path).realpath.to_s
path = Pathname.new(File.expand_path(path))
# Make sure the path is a valid directory before we try to rock the
# house
if (File.directory?(path) == false)
unless (path.directory?)
raise RuntimeError, "The path supplied is not a valid directory.",
caller
end
# Now that we've confirmed it exists, get the full, cononical path
path = path.realpath.to_s
module_paths << path
begin