lib/review/epubmaker/producer.rb in review-5.6.0 vs lib/review/epubmaker/producer.rb in review-5.7.0

- old
+ new

@@ -1,8 +1,8 @@ # = producer.rb -- EPUB producer. # -# Copyright (c) 2010-2021 Kenshi Muto +# Copyright (c) 2010-2023 Kenshi Muto # # This program is free software. # You can distribute or modify this program under the terms of # the GNU LGPL, Lesser General Public License version 2.1. # For details of the GNU LGPL, see the file "COPYING". @@ -117,11 +117,10 @@ new_tmpdir = Dir[File.join(tmpdir.nil? ? Dir.mktmpdir : tmpdir)][0] unless epubfile.start_with?('/') epubfile = "#{current}/#{epubfile}" end - # FIXME: error check - File.unlink(epubfile) if File.exist?(epubfile) + FileUtils.rm_f(epubfile) begin @epub.produce(epubfile, work_dir, new_tmpdir, base_dir: base_dir) ensure FileUtils.rm_r(new_tmpdir) if tmpdir.nil?