Shin-ya Murakami
null****@okkez*****
2013年 11月 19日 (火) 16:15:28 JST
Shin-ya Murakami 2013-11-19 16:15:28 +0900 (Tue, 19 Nov 2013) New Revision: d13ea898fff5e64bd551512a642a21ff853562da https://github.com/hiki/hiki/commit/d13ea898fff5e64bd551512a642a21ff853562da Merged d30fe47: Merge pull request #45 from murashin/master Message: add support for misc/plugin/attach.rb with encoded filename Modified files: tool/convert.rb Modified: tool/convert.rb (+9 -0) =================================================================== --- tool/convert.rb 2013-11-16 14:43:35 +0900 (2738b93) +++ tool/convert.rb 2013-11-19 16:15:28 +0900 (18ea0c8) @@ -44,6 +44,15 @@ def convert(data_path, database_class, input_encoding, output_encoding, nkf) print "#{Hiki::Util.escape(old_page)} => #{Hiki::Util.escape(new_page)}" attach_path = data_path + "cache/attach/" if Dir.exist? attach_path + Hiki::Util.escape(old_page) + Dir.glob("#{attach_path}#{Hiki::Util.escape(old_page)}/*").each do |old_file_fullpath| + old_file = File.basename(old_file_fullpath) + new_file = Hiki::Util.escape(encode(Hiki::Util.unescape(old_file), + input_encoding, output_encoding, nkf)) + new_file_fullpath = "#{attach_path}#{Hiki::Util.escape(old_page)}/#{new_file}" + if old_file != new_file + FileUtils.mv(old_file_fullpath, new_file_fullpath) + end + end if Hiki::Util.escape(old_page) != Hiki::Util.escape(new_page) FileUtils.mv("#{attach_path}/#{Hiki::Util.escape(old_page)}", "#{attach_path}/#{Hiki::Util.escape(new_page)}") end