Merge pull request #2888 from obfusk/fix-mktmpdir

core: Clean up temp dir used by fs_case_sensitive?
This commit is contained in:
Mitchell Hashimoto 2014-01-27 09:26:43 -08:00
commit 83b22de944
1 changed files with 9 additions and 8 deletions

View File

@ -57,15 +57,16 @@ module Vagrant
# 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
Dir.mktmpdir("vagrant") do |tmp_dir|
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"))
# The filesystem is case sensitive if the lowercased version
# of the filename is NOT reported as existing.
!File.file?(File.join(tmp_dir, "file"))
end
end
# This expands the path and ensures proper casing of each part