From 5c3555b56bb887bee2db57c9231f6c7834ec6de0 Mon Sep 17 00:00:00 2001 From: "Felix C. Stegerman" Date: Sat, 25 Jan 2014 04:57:52 +0100 Subject: [PATCH] Clean up temp dir used by fs_case_sensitive? --- lib/vagrant/util/platform.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/vagrant/util/platform.rb b/lib/vagrant/util/platform.rb index 53da7df0a..bb9181648 100644 --- a/lib/vagrant/util/platform.rb +++ b/lib/vagrant/util/platform.rb @@ -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