Preserve Disk Image Name
detect and preserve the original name of the disk image rather than forcing it to be disk
This commit is contained in:
parent
43e90666e1
commit
343a43cae6
|
@ -38,10 +38,12 @@ module VagrantPlugins
|
||||||
|
|
||||||
image_path = nil
|
image_path = nil
|
||||||
image_ext = nil
|
image_ext = nil
|
||||||
|
image_filename = nil
|
||||||
hd_dir.each_child do |f|
|
hd_dir.each_child do |f|
|
||||||
if %w{.vhd .vhdx}.include?(f.extname.downcase)
|
if %w{.vhd .vhdx}.include?(f.extname.downcase)
|
||||||
image_path = f
|
image_path = f
|
||||||
image_ext = f.extname.downcase
|
image_ext = f.extname.downcase
|
||||||
|
image_filename = File.basename(f,image_ext)
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -92,7 +94,7 @@ module VagrantPlugins
|
||||||
|
|
||||||
env[:ui].detail("Cloning virtual hard drive...")
|
env[:ui].detail("Cloning virtual hard drive...")
|
||||||
source_path = image_path.to_s
|
source_path = image_path.to_s
|
||||||
dest_path = env[:machine].data_dir.join("disk#{image_ext}").to_s
|
dest_path = env[:machine].data_dir.join("#{image_filename}#{image_ext}").to_s
|
||||||
FileUtils.cp(source_path, dest_path)
|
FileUtils.cp(source_path, dest_path)
|
||||||
image_path = dest_path
|
image_path = dest_path
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue