Skip to content
This repository has been archived by the owner on Aug 17, 2019. It is now read-only.

Commit

Permalink
[init] adapt Context base path for file loader
Browse files Browse the repository at this point in the history
Fix issue lualatex#344

The paths changed a while ago making a change necessary. We can’t just
replace the path because older versions of the tree would fail,
rendering bisection unusable. We compensate by testing the candidate
directories beforehand.
  • Loading branch information
phi-gamma committed Jun 10, 2016
1 parent a8cae34 commit e391f0e
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions src/luaotfload-init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

local setmetatable = setmetatable
local kpselookup = kpse.lookup
local lfsisdir = lfs.isdir

--[[doc--
Expand Down Expand Up @@ -223,7 +224,7 @@ end

--- below paths are relative to the texmf-context
local ltx = "tex/generic/context/luatex"
local ctx = "tex/context/base"
local ctx = { "tex/context/base/mkiv", "tex/context/base" }

local context_modules = {

Expand Down Expand Up @@ -285,17 +286,37 @@ local load_context_modules = function (pth)
local sub, spec = unpack (context_modules [i])
if sub == false then
ignore_module (spec)
elseif type (sub) == "string" then
if pth then
else
local tsub = type (sub)
if not pth then
load_module (spec)
elseif tsub == "string" then
load_module (spec, file.join (pth, sub))
elseif tsub == "table" then
local pfx
local nsub = #sub
for j = 1, nsub do
local full = file.join (pth, sub [j])
if lfsisdir (full) then --- pick the first real one
pfx = full
break
end
end
if pfx then
load_module (spec, pfx)
else
logreport ("both", 0, "init",
"None of the %d search paths for module %q exist; \z
falling back to default path.",
nsub, tostring (spec))
load_module (spec) --- maybe we’ll get by after all?
end
else
load_module (spec)
logreport ("both", 0, "init",
"Internal error, please report. \z
This is not your fault.")
os.exit (-1)
end
else
logreport ("both", 0, "init",
"Internal error, please report. \z
This is not your fault.")
os.exit (-1)
end
end

Expand Down Expand Up @@ -535,7 +556,7 @@ local init_main = function ()
"Loading Context modules in lookup path.")
load_context_modules ()

elseif lfs.isdir (fontloader) then
elseif lfsisdir (fontloader) then
logreport ("log", 0, "init",
"Loading Context files under prefix “%s”.",
fontloader)
Expand Down

0 comments on commit e391f0e

Please sign in to comment.