diff options
author | Philipp Gesang <phg@phi-gamma.net> | 2016-06-10 08:00:50 +0200 |
---|---|---|
committer | Philipp Gesang <phg@phi-gamma.net> | 2016-06-10 08:21:28 +0200 |
commit | e391f0e473b9a2987bd27841f96f91f3379b767d (patch) | |
tree | 9a5c318557b5065e5dd2b1ece93c16afc4ad6bf2 /src/luaotfload-init.lua | |
parent | a8cae347b3c8a3154c36444e5d38705b59e5e57e (diff) | |
download | luaotfload-e391f0e473b9a2987bd27841f96f91f3379b767d.tar.gz |
[init] adapt Context base path for file loader
Fix issue #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.
Diffstat (limited to 'src/luaotfload-init.lua')
-rw-r--r-- | src/luaotfload-init.lua | 41 |
1 files changed, 31 insertions, 10 deletions
diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua index 48a8eba..3c0b622 100644 --- a/src/luaotfload-init.lua +++ b/src/luaotfload-init.lua @@ -9,6 +9,7 @@ local setmetatable = setmetatable local kpselookup = kpse.lookup +local lfsisdir = lfs.isdir --[[doc-- @@ -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 = { @@ -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 @@ -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) |