From 60620185a92d7e383c26fe8ba4364ed517d6e298 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= <mpg@elzevir.fr>
Date: Mon, 29 Mar 2010 08:06:05 +0200
Subject: Use emulation as a fallback search mode.

---
 luatexbase-loader.dtx | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

(limited to 'luatexbase-loader.dtx')

diff --git a/luatexbase-loader.dtx b/luatexbase-loader.dtx
index 6d72a36..68e6755 100644
--- a/luatexbase-loader.dtx
+++ b/luatexbase-loader.dtx
@@ -291,7 +291,7 @@ local lua_suffixes = {
   ".luc", ".luctex", ".texluc",
   ".lua", ".luatex", ".texlua",
 }
-local function find_file_lua(name)
+local function find_file_lua_emul(name)
   for _, suf in ipairs(lua_suffixes) do
     local name = name..suf
     local f = kpse.find_file(name, 'texmfscripts')
@@ -301,12 +301,18 @@ local function find_file_lua(name)
 end
 %    \end{macrocode}
 %
-%    Don't use the emulated version if kpse lua format works.
+%    If lua search format is available, use it with emulation as a fall-back,
+%    or just use emulation.
 %
 %    \begin{macrocode}
+local find_file_lua
 if pcall('kpse.find_file', 'dummy', 'lua') then
-  find_file_lua = function(name)
-    return kpse.find_file(name, 'lua')
+  find_file_lua = function (name)
+    return kpse.find_file(name, 'lua') or find_file_lua_emul(name)
+  end
+else
+  find_file_lua = function (name)
+    return find_file_lua_emul(name)
   end
 end
 %    \end{macrocode}
-- 
cgit v1.2.3

