diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index aaa7a92da..792faa18b 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -1,4 +1,5 @@ require 'rbconfig' +require 'tmpdir' require "vagrant/util/subprocess" @@ -39,6 +40,22 @@ module Vagrant process.stdout.chomp end + # This checks if the filesystem is case sensitive. This is not a + # 100% correct check, since it is possible that the temporary + # directory runs a different filesystem than the root directory. + # However, this works in many cases. + def fs_case_sensitive? + tmp_dir = Dir.mktmpdir("vagrant") + tmp_file = File.join(tmp_dir, "FILE") + File.open(tmp_file, "w") do |f| + f.write("foo") + end + + # The filesystem is case sensitive if the lowercased version + # of the filename is NOT reported as existing. + return !File.file?(File.join(tmp_dir, "file")) + end + # Returns a boolean noting whether the terminal supports color. # output. def terminal_supports_colors?