diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 3382f2e69..120db6986 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -60,7 +60,18 @@ module Vagrant # of the path. def fs_real_path(path) path = Pathname.new(File.expand_path(path)) - raise "Path must exist for path expansion" if !path.exist? + + if windows? + # Fix the drive letter to be uppercase. + path = path.to_s + if path[1] == ":" + path[0] = path[0].upcase + end + + path = Pathname.new(path) + end + + return path if !path.exist? return path if fs_case_sensitive? # Build up all the parts of the path diff --git a/plugins/synced_folders/rsync/helper.rb b/plugins/synced_folders/rsync/helper.rb index 9627801e4..cef789bf7 100644 --- a/plugins/synced_folders/rsync/helper.rb +++ b/plugins/synced_folders/rsync/helper.rb @@ -1,3 +1,4 @@ +require "vagrant/util/platform" require "vagrant/util/subprocess" module VagrantPlugins @@ -10,6 +11,7 @@ module VagrantPlugins guestpath = opts[:guestpath] hostpath = opts[:hostpath] hostpath = File.expand_path(hostpath, machine.env.root_path) + hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s # Connection information username = ssh_info[:username] diff --git a/test/unit/plugins/synced_folders/rsync/helper_test.rb b/test/unit/plugins/synced_folders/rsync/helper_test.rb index d846558ca..a8505ff36 100644 --- a/test/unit/plugins/synced_folders/rsync/helper_test.rb +++ b/test/unit/plugins/synced_folders/rsync/helper_test.rb @@ -1,5 +1,7 @@ require_relative "../../../base" +require "vagrant/util/platform" + require Vagrant.source_root.join("plugins/synced_folders/rsync/helper") describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do @@ -56,7 +58,7 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do opts[:guestpath] = "/bar" Vagrant::Util::Subprocess.should_receive(:execute).with do |*args| - expect(args[args.length - 3]).to eql("/foo") + expect(args[args.length - 3]).to eql(Vagrant::Util::Platform.fs_real_path("/foo").to_s) expect(args[args.length - 2]).to include("/bar") end