diff --git a/plugins/hosts/darwin/cap/path.rb b/plugins/hosts/darwin/cap/path.rb index c39d63319..0fbc03ce4 100644 --- a/plugins/hosts/darwin/cap/path.rb +++ b/plugins/hosts/darwin/cap/path.rb @@ -1,3 +1,5 @@ +require "vagrant/util" + module VagrantPlugins module HostDarwin module Cap @@ -15,6 +17,10 @@ module VagrantPlugins # @return [String] resolved path def self.resolve_host_path(env, path) path = File.expand_path(path) + volume = volume_list.detect do |volume_path| + path.start_with?(volume_path) + end + return path unless volume.nil? firmlink = firmlink_map.detect do |mount_path, data_path| path.start_with?(mount_path) end @@ -26,6 +32,25 @@ module VagrantPlugins new_path end + MOUNT_PATTERN = /^(?.+?) on (?.+?) type (?.+?) \((?.+)\)/.freeze + + # Generate list of Volumes if available on the host + # + # @return [Array] + def self.volume_list + if !@volume_list + @volume_list = [] + result = Vagrant::Util::Subprocess.execute("mount") + result.stdout.each_line do |line| + info = line.match(MOUNT_PATTERN) + if info && info[:mount] != "/" + @volume_list << info[:mount] + end + end + end + @volume_list + end + # Generate mapping of firmlinks if available on the host # # @return [Hash]