From 74aefa5c3da97c38736d9a16e3b189f013270ae4 Mon Sep 17 00:00:00 2001 From: John Bender Date: Sat, 22 May 2010 22:46:42 -0700 Subject: [PATCH] corrected bit mask for package output on windows --- lib/vagrant/actions/box/download.rb | 7 +- lib/vagrant/actions/vm/package.rb | 2 +- lib/vagrant/util/platform.rb | 9 +- test/vagrant/actions/box/download_test.rb | 17 --- test/vagrant/actions/vm/package_test.rb | 2 +- test/vagrant/util/platform_test.rb | 18 ++++ vagrant.gemspec | 120 +++++++++++----------- 7 files changed, 89 insertions(+), 86 deletions(-) create mode 100644 test/vagrant/util/platform_test.rb 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 <