diff --git a/plugins/providers/virtualbox/driver/version_4_2.rb b/plugins/providers/virtualbox/driver/version_4_2.rb index 8bec8acca..de8a16733 100644 --- a/plugins/providers/virtualbox/driver/version_4_2.rb +++ b/plugins/providers/virtualbox/driver/version_4_2.rb @@ -185,7 +185,11 @@ module VagrantPlugins disk_params << "--unit" disk_params << unit_num disk_params << "--disk" - disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurence + if Gem.win_platform? + disk_params << path.reverse.sub("\\#{suggested_name}\\".reverse, "\\#{specified_name}\\".reverse).reverse # Replace only last occurence + else + disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurence + end end execute("import", ovf , *name_params, *disk_params) do |type, data| diff --git a/plugins/providers/virtualbox/driver/version_4_3.rb b/plugins/providers/virtualbox/driver/version_4_3.rb index 5c7deb031..d83b0adf6 100644 --- a/plugins/providers/virtualbox/driver/version_4_3.rb +++ b/plugins/providers/virtualbox/driver/version_4_3.rb @@ -193,7 +193,11 @@ module VagrantPlugins disk_params << "--unit" disk_params << unit_num disk_params << "--disk" - disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurence + if Gem.win_platform? + disk_params << path.reverse.sub("\\#{suggested_name}\\".reverse, "\\#{specified_name}\\".reverse).reverse # Replace only last occurence + else + disk_params << path.reverse.sub("/#{suggested_name}/".reverse, "/#{specified_name}/".reverse).reverse # Replace only last occurence + end end execute("import", ovf , *name_params, *disk_params) do |type, data|