summaryrefslogtreecommitdiff
path: root/tex/context/base/mkiv/util-lib.lua
diff options
context:
space:
mode:
authorHans Hagen <pragma@wxs.nl>2017-03-23 18:35:01 +0100
committerContext Git Mirror Bot <phg42.2a@gmail.com>2017-03-23 18:35:01 +0100
commit576286d4c1349c644bea833c99ec5364668ffc8a (patch)
treeddaa0e3880a084eb52cf0cc9658d5e2d59377392 /tex/context/base/mkiv/util-lib.lua
parent1987348696a38821137cc579a986d37086b87404 (diff)
downloadcontext-576286d4c1349c644bea833c99ec5364668ffc8a.tar.gz
2017-03-23 17:26:00
Diffstat (limited to 'tex/context/base/mkiv/util-lib.lua')
-rw-r--r--tex/context/base/mkiv/util-lib.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/tex/context/base/mkiv/util-lib.lua b/tex/context/base/mkiv/util-lib.lua
index 98c417b8e..90a06f109 100644
--- a/tex/context/base/mkiv/util-lib.lua
+++ b/tex/context/base/mkiv/util-lib.lua
@@ -100,15 +100,15 @@ local function locate(required,version,trace,report,action)
report("requiring library %a with version %a",required,version or "any")
end
local found_library = nil
+ local required_full = gsub(required,"%.","/") -- package.helpers.lualibfile
+ local required_path = pathpart(required_full)
+ local required_base = nameonly(required_full)
if qualifiedpath(required) then
if isfile(required) then
found_library = required
end
else
-- initialize a few variables
- local required_full = gsub(required,"%.","/") -- package.helpers.lualibfile
- local required_path = pathpart(required_full)
- local required_base = nameonly(required_full)
local required_name = required_base .. "." .. os.libsuffix
local version = type(version) == "string" and version ~= "" and version or false
local engine = environment.ownmain or false
@@ -233,6 +233,10 @@ do
local trace_swiglib = false
local savedrequire = require
local loadedlibs = { }
+ local loadlib = package.loadlib
+
+ local pushdir = dir.push
+ local popdir = dir.pop
trackers.register("resolvers.swiglib", function(v) trace_swiglib = v end)
@@ -241,9 +245,9 @@ do
if library == nil then
local trace_swiglib = trace_swiglib or package.helpers.trace
library = locate(required,version,trace_swiglib,report_swiglib,function(name,base)
- dir.push(pathpart(name))
+ pushdir(pathpart(name))
local opener = "luaopen_" .. base
- local library, message = package.loadlib(name,opener)
+ local library, message = loadlib(name,opener)
local libtype = type(library)
if libtype == "function" then
library = library()
@@ -252,7 +256,7 @@ do
report_swiglib("load error: %a returns %a, message %a, library %a",opener,libtype,(string.gsub(message or "no message","[%s]+$","")),found_library or "no library")
library = false
end
- dir.pop()
+ popdir()
return message, library
end)
loadedlibs[required] = library or false