Skip to content

Commit

Permalink
PDFMaker: check file existence
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuto committed Jul 30, 2024
1 parent 176be96 commit ab4c9e9
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/review/pdfmaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ def make_custom_page(file)
File.read(file_sty)
else
warn "File #{file_sty} is not found."
nil
end
end

Expand Down Expand Up @@ -505,6 +506,15 @@ def template_content
template_dir = @basedir
template_path = 'layouts/layout.tex.erb'
end

if @config['cover'] && !File.exist?(@config['cover'])
error! "File #{@config['cover']} is not found."
end

if @config['titlepage'] && @config['titlefile'] && !File.exist?(@config['titlefile'])
error! "File #{@config['titlefile']} is not found."
end

ReVIEW::Template.generate(path: template_path, mode: '-', binding: binding, template_dir: template_dir)
rescue StandardError => e
if defined?(e.full_message)
Expand Down

0 comments on commit ab4c9e9

Please sign in to comment.