Platform helpers to detect 64-bit and 32-bit CPU.

This commit is contained in:
Mitchell Hashimoto 2010-12-18 12:02:48 -08:00
parent 8c13d1919e
commit 3f2f5685b2
1 changed files with 16 additions and 0 deletions

View File

@ -28,6 +28,22 @@ module Vagrant
false
end
# Returns boolean noting whether this is a 64-bit CPU. This
# is not 100% accurate and there could easily be false negatives.
#
# @return [Boolean]
def bit64?
["x86_64", "amd64"].include?(::Config::CONFIG["host_cpu"])
end
# Returns boolean noting whether this is a 32-bit CPU. This
# can easily throw false positives since it relies on {#bit64?}.
#
# @return [Boolean]
def bit32?
!bit64?
end
def tar_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)