From a1090f912cc29bc7cffbd93c1426960a28805489 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Wed, 18 Dec 2013 14:54:07 -0800 Subject: [PATCH] fix issue with UTF-8-MAC paths not matching UTF-8 paths in build clean --- middleman-core/lib/middleman-core/cli/build.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/middleman-core/lib/middleman-core/cli/build.rb b/middleman-core/lib/middleman-core/cli/build.rb index f548183c..ca74bc53 100644 --- a/middleman-core/lib/middleman-core/cli/build.rb +++ b/middleman-core/lib/middleman-core/cli/build.rb @@ -159,6 +159,7 @@ module Middleman::Cli return unless File.exist?(@build_dir) paths = ::Middleman::Util.all_files_under(@build_dir).map(&:realpath).select(&:file?) + @to_clean += paths.select do |path| path.to_s !~ /\/\./ || path.to_s =~ /\.(htaccess|htpasswd)/ end @@ -211,7 +212,13 @@ module Middleman::Cli output_path = render_to_file(resource) if should_clean? && output_path.exist? - @to_clean.delete(output_path.realpath) + if RUBY_PLATFORM =~ /darwin/ + # handle UTF-8-MAC filename on MacOS + + @to_clean.delete(output_path.realpath.to_s.encode('UTF-8', 'UTF-8-MAC')) + else + @to_clean.delete(output_path.realpath) + end end end