From 8e99d3957019c8924b9f2a88ac37891be751a210 Mon Sep 17 00:00:00 2001 From: fukayatsu Date: Sun, 24 Nov 2013 02:10:46 +0900 Subject: [PATCH] Handle UTF-8-MAC filename on MacOS --- middleman-core/lib/middleman-core/cli/build.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/cli/build.rb b/middleman-core/lib/middleman-core/cli/build.rb index 7719bac7..7b256e2d 100644 --- a/middleman-core/lib/middleman-core/cli/build.rb +++ b/middleman-core/lib/middleman-core/cli/build.rb @@ -205,8 +205,13 @@ module Middleman::Cli output_path = render_to_file(resource) - if should_clean? - @to_clean.delete(output_path.realpath) if output_path.exist? + if should_clean? && output_path.exist? + if RUBY_PLATFORM =~ /darwin/ + # handle UTF-8-MAC filename on MacOS + @to_clean.delete_if { |path| path.to_s.encode('UTF-8', 'UTF-8-MAC') == output_path.realpath.to_s } + else + @to_clean.delete(output_path.realpath) + end end end