Clean up temp dir used by fs_case_sensitive?

This commit is contained in:
Felix C. Stegerman 2014-01-25 04:57:52 +01:00
parent 00530303fb
commit 5c3555b56b
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