From 7ccf7fadf2b39cd7f4f8e5ec01a9f22d312f31e8 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 14 Mar 2014 12:34:36 -0700 Subject: [PATCH] providers/virtualbox: make ID os-friendly for Windows --- plugins/providers/virtualbox/synced_folder.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/plugins/providers/virtualbox/synced_folder.rb b/plugins/providers/virtualbox/synced_folder.rb index dfd8251dc..e5c147078 100644 --- a/plugins/providers/virtualbox/synced_folder.rb +++ b/plugins/providers/virtualbox/synced_folder.rb @@ -14,7 +14,7 @@ module VagrantPlugins hostpath = Vagrant::Util::Platform.cygwin_windows_path(data[:hostpath]) defs << { - name: id, + name: os_friendly_id(id), hostpath: hostpath.to_s, transient: data[:transient], } @@ -53,7 +53,8 @@ module VagrantPlugins # Mount the actual folder machine.guest.capability( - :mount_virtualbox_shared_folder, id, data[:guestpath], data) + :mount_virtualbox_shared_folder, + os_friendly_id(id), data[:guestpath], data) else # If no guest path is specified, then automounting is disabled machine.ui.detail(I18n.t("vagrant.actions.vm.share_folders.nomount_entry", @@ -72,6 +73,10 @@ module VagrantPlugins def driver(machine) machine.provider.driver end + + def os_friendly_id(id) + id.gsub(/[\/]/,'_').sub(/^_/, '') + end end end end