diff --git a/lib/aozoraepub3.rb b/lib/aozoraepub3.rb index f2689aa8..7da7faef 100644 --- a/lib/aozoraepub3.rb +++ b/lib/aozoraepub3.rb @@ -127,8 +127,12 @@ def clear_log end attr_reader :updated_file_paths, :copied_file_paths - def self.get_custom_file_path(file_path) - File.join(File.dirname(file_path) + "_custom", File.basename(file_path)) + def self.get_custom_file_path(file_path, should_create_directory) + dir_path = File.dirname(file_path) + "_custom" + if should_create_directory + FileUtils.mkdir_p(dir_path) + end + File.join(dir_path, File.basename(file_path)) end # iniファイルのコピー @@ -197,7 +201,7 @@ def create_css_text2(original_css_path, css_template_path, yokogaki, use_dakuten # カスタムCSSファイルの配置 def create_custom_css_file(dst_css_file_path, css) - custom_css_file_path = AozoraResourceUpdater.get_custom_file_path(dst_css_file_path) + custom_css_file_path = AozoraResourceUpdater.get_custom_file_path(dst_css_file_path, true) file_write(custom_css_file_path, css) @copied_file_paths << custom_css_file_path end