fix issue with UTF-8-MAC paths not matching UTF-8 paths in build clean

This commit is contained in:
Thomas Reynolds 2013-12-18 14:54:07 -08:00
parent f9728108cc
commit a1090f912c

View file

@ -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