Skip to content

Commit

Permalink
fix basedir to use extracted absolute path. Closes #1086
Browse files Browse the repository at this point in the history
  • Loading branch information
kmuto committed Jul 29, 2018
1 parent 9aaf18f commit 57bdfc6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/review/pdfmaker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ class PDFMaker
include FileUtils
include ReVIEW::LaTeXUtils

attr_accessor :config, :basedir, :basehookdir
attr_accessor :config, :basedir

def initialize
@basedir = nil
@basehookdir = nil
@logger = ReVIEW.logger
@input_files = Hash.new { |h, key| h[key] = '' }
@mastertex = '__REVIEW_BOOK__'
Expand Down Expand Up @@ -134,8 +133,7 @@ def execute(*args)
# YAML configs will be overridden by command line options.
@config.deep_merge!(cmd_config)
I18n.setup(@config['language'])
@basedir = File.dirname(yamlfile)
@basehookdir = File.absolute_path(File.dirname(yamlfile))
@basedir = File.absolute_path(File.dirname(yamlfile))

begin
@config.check_version(ReVIEW::VERSION)
Expand Down Expand Up @@ -472,11 +470,11 @@ def copy_sty(dirname, copybase, extname = 'sty')

def call_hook(hookname)
return if !@config['pdfmaker'].is_a?(Hash) || @config['pdfmaker'][hookname].nil?
hook = File.absolute_path(@config['pdfmaker'][hookname], @basehookdir)
hook = File.absolute_path(@config['pdfmaker'][hookname], @basedir)
if ENV['REVIEW_SAFE_MODE'].to_i & 1 > 0
warn 'hook configuration is prohibited in safe mode. ignored.'
else
system_or_raise("#{hook} #{Dir.pwd} #{@basehookdir}")
system_or_raise("#{hook} #{Dir.pwd} #{@basedir}")
end
end
end
Expand Down

0 comments on commit 57bdfc6

Please sign in to comment.