providers/virtualbox: make ID os-friendly for Windows

This commit is contained in:
Mitchell Hashimoto 2014-03-14 12:34:36 -07:00
parent a908b191b0
commit 7ccf7fadf2
1 changed files with 7 additions and 2 deletions

View File

@ -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