Windows root path checking. Interim solution.
This commit is contained in:
parent
bee84a9cb0
commit
6c5ddcdf8d
|
@ -89,7 +89,10 @@ module Vagrant
|
|||
def load_root_path!(path=nil)
|
||||
path ||= Pathname.new(Dir.pwd)
|
||||
|
||||
return false if path.to_s == '/'
|
||||
# Stop if we're at the root. 2nd regex matches windows drives
|
||||
# such as C:. and Z:. Portability of this check will need to be
|
||||
# researched.
|
||||
return false if path.to_s == '/' || path.to_s =~ /^[A-Z]:\.$/
|
||||
|
||||
file = "#{path}/#{ROOTFILE_NAME}"
|
||||
if File.exist?(file)
|
||||
|
|
|
@ -218,11 +218,16 @@ class EnvTest < Test::Unit::TestCase
|
|||
assert !Vagrant::Env.load_root_path!(paths.first)
|
||||
end
|
||||
|
||||
should "should return false if not found" do
|
||||
should "return false if not found" do
|
||||
path = Pathname.new("/")
|
||||
assert !Vagrant::Env.load_root_path!(path)
|
||||
end
|
||||
|
||||
should "return false if not found on windows-style root" do
|
||||
path = Pathname.new("C:.")
|
||||
assert !Vagrant::Env.load_root_path!(path)
|
||||
end
|
||||
|
||||
should "should set the path for the rootfile" do
|
||||
path = "/foo"
|
||||
File.expects(:exist?).with("#{path}/#{Vagrant::Env::ROOTFILE_NAME}").returns(true)
|
||||
|
|
Loading…
Reference in New Issue