synced_folders/rsync: run hostpath through fs_real_path
This fixes issues with drive letter casing on Windows
This commit is contained in:
parent
8a56d0ae5e
commit
4fab57576b
|
@ -60,7 +60,18 @@ module Vagrant
|
||||||
# of the path.
|
# of the path.
|
||||||
def fs_real_path(path)
|
def fs_real_path(path)
|
||||||
path = Pathname.new(File.expand_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?
|
return path if fs_case_sensitive?
|
||||||
|
|
||||||
# Build up all the parts of the path
|
# Build up all the parts of the path
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
require "vagrant/util/platform"
|
||||||
require "vagrant/util/subprocess"
|
require "vagrant/util/subprocess"
|
||||||
|
|
||||||
module VagrantPlugins
|
module VagrantPlugins
|
||||||
|
@ -10,6 +11,7 @@ module VagrantPlugins
|
||||||
guestpath = opts[:guestpath]
|
guestpath = opts[:guestpath]
|
||||||
hostpath = opts[:hostpath]
|
hostpath = opts[:hostpath]
|
||||||
hostpath = File.expand_path(hostpath, machine.env.root_path)
|
hostpath = File.expand_path(hostpath, machine.env.root_path)
|
||||||
|
hostpath = Vagrant::Util::Platform.fs_real_path(hostpath).to_s
|
||||||
|
|
||||||
# Connection information
|
# Connection information
|
||||||
username = ssh_info[:username]
|
username = ssh_info[:username]
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
require_relative "../../../base"
|
require_relative "../../../base"
|
||||||
|
|
||||||
|
require "vagrant/util/platform"
|
||||||
|
|
||||||
require Vagrant.source_root.join("plugins/synced_folders/rsync/helper")
|
require Vagrant.source_root.join("plugins/synced_folders/rsync/helper")
|
||||||
|
|
||||||
describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
|
describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
|
||||||
|
@ -56,7 +58,7 @@ describe VagrantPlugins::SyncedFolderRSync::RsyncHelper do
|
||||||
opts[:guestpath] = "/bar"
|
opts[:guestpath] = "/bar"
|
||||||
|
|
||||||
Vagrant::Util::Subprocess.should_receive(:execute).with do |*args|
|
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")
|
expect(args[args.length - 2]).to include("/bar")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue