diff --git a/lib/vagrant/actions/box/download.rb b/lib/vagrant/actions/box/download.rb index 9d12e713f..f066b2946 100644 --- a/lib/vagrant/actions/box/download.rb +++ b/lib/vagrant/actions/box/download.rb @@ -48,16 +48,11 @@ module Vagrant def with_tempfile logger.info "Creating tempfile for storing box file..." - File.open(box_temp_path, file_options) do |tempfile| + File.open(box_temp_path, Platform.tar_file_options) do |tempfile| yield tempfile end end - def file_options - # create, write only, fail if the file exists, binary if windows - File::WRONLY|File::EXCL|File::CREAT|(Mario::Platform.windows? ? File::BINARY : 0) - end - def box_temp_path File.join(@runner.env.tmp_path, BASENAME + Time.now.to_i.to_s) end diff --git a/lib/vagrant/actions/vm/package.rb b/lib/vagrant/actions/vm/package.rb index b0b25e523..894ae352d 100644 --- a/lib/vagrant/actions/vm/package.rb +++ b/lib/vagrant/actions/vm/package.rb @@ -64,7 +64,7 @@ module Vagrant def compress logger.info "Packaging VM into #{tar_path}..." - File.open(tar_path, File::CREAT | File::WRONLY, 0644) do |tar| + File.open(tar_path, Platform.tar_file_options) do |tar| Archive::Tar::Minitar::Output.open(tar) do |output| begin current_dir = FileUtils.pwd diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 80c4849c9..303a7559c 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -2,11 +2,16 @@ module Vagrant module Util # This class just contains some platform checking code. class Platform - class <