From 24aaa7f282648e5f12d3d7de0a55343d9666fbf9 Mon Sep 17 00:00:00 2001 From: Martin Ehrnhoefer Date: Sat, 16 Mar 2013 13:04:33 +0100 Subject: [PATCH] Adding a box fails on Windows [GH-1424] The Dir.mkdir statement fails on Windows if src and dest reside on different partitions. Files are therefore copied one-by-one. The #6715 workaround is not needed anymore. --- lib/vagrant/box_collection.rb | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/vagrant/box_collection.rb b/lib/vagrant/box_collection.rb index 25366330b..a40db9606 100644 --- a/lib/vagrant/box_collection.rb +++ b/lib/vagrant/box_collection.rb @@ -147,12 +147,10 @@ module Vagrant end # Move to final destination - FileUtils.mv(temp_dir.to_s, final_dir.to_s) - - # Recreate the directory. This avoids a bug in Ruby where `mktmpdir` - # cleanup doesn't check if the directory is already gone. Ruby bug - # #6715: http://bugs.ruby-lang.org/issues/6715 - Dir.mkdir(temp_dir, 0700) + final_dir.mkpath + temp_dir.children(true).each do |f| + FileUtils.mv(f, final_dir.join(f.basename)) + end end # Return the box