[latex3-commits] [git/LaTeX3-latex3-luaotfload] dev: Sanity check context directory fontloader (9b2d63b)

Marcel Fabian Krüger tex at 2krueger.de
Sun Jan 26 10:16:11 CET 2020


Repository : https://github.com/latex3/luaotfload
On branch  : dev
Link       : https://github.com/latex3/luaotfload/commit/9b2d63b6dc90fbe106f920ce4010225f478f5513

>---------------------------------------------------------------

commit 9b2d63b6dc90fbe106f920ce4010225f478f5513
Author: Marcel Fabian Krüger <tex at 2krueger.de>
Date:   Sun Jan 26 10:16:11 2020 +0100

    Sanity check context directory fontloader
    
    Fixes #4.


>---------------------------------------------------------------

9b2d63b6dc90fbe106f920ce4010225f478f5513
 src/luaotfload-init.lua | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/src/luaotfload-init.lua b/src/luaotfload-init.lua
index 7c4bad1..4550611 100644
--- a/src/luaotfload-init.lua
+++ b/src/luaotfload-init.lua
@@ -192,6 +192,22 @@ local load_context_modules = function (pth)
 
 end
 
+local function verify_context_dir (pth)
+  if lfsisdir(file.join(pth, ltx)) then
+    return true
+  end
+  for _, d in ipairs(ctx) do
+    if lfsisdir(file.join(pth, d)) then
+      return true
+    end
+  end
+  logreport("both", 0, "init", "A directory name has been passed as \z
+    fontloader name but this directory does not acutally seem to contain \z
+    a font loader. I will try to interpret your fontloader name in another \z
+    way for now, but please fix your settings.")
+  return false
+end
+
 local function init_main(early_hook)
   config                       = config or { } --- global
   config.luaotfload            = config.luaotfload or { }
@@ -374,7 +390,7 @@ local function init_main(early_hook)
                "Loading Context modules in lookup path.")
     load_context_modules ()
 
-  elseif lfsisdir (fontloader) then
+  elseif lfsisdir (fontloader) and verify_context_dir (fontloader) then
     logreport ("log", 0, "init",
                "Loading Context files under prefix “%s”.",
                fontloader)





More information about the latex3-commits mailing list