diff options
Diffstat (limited to 'Master/texmf-dist/tex/context/base/mkiv/l-package.lua')
-rw-r--r-- | Master/texmf-dist/tex/context/base/mkiv/l-package.lua | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Master/texmf-dist/tex/context/base/mkiv/l-package.lua b/Master/texmf-dist/tex/context/base/mkiv/l-package.lua index 075fcde25ae..d43c5c5c6bb 100644 --- a/Master/texmf-dist/tex/context/base/mkiv/l-package.lua +++ b/Master/texmf-dist/tex/context/base/mkiv/l-package.lua @@ -23,6 +23,10 @@ local P, S, Cs, lpegmatch = lpeg.P, lpeg.S, lpeg.Cs, lpeg.match local package = package local searchers = package.searchers or package.loaders +local insert, remove = table.insert, table.remove + +-------.loaders = nil -- old stuff that we don't want +-------.seeall = nil -- old stuff that we don't want -- dummies @@ -191,7 +195,25 @@ local function registerpath(tag,what,target,...) add(path) end end - return paths +end + +local function pushpath(tag,what,target,path) + local path = helpers.cleanpath(path) + insert(target,1,path) + if helpers.trace then + helpers.report("pushing %s path in front: %s",tag,path) + end +end + +local function poppath(tag,what,target) + local path = remove(target,1) + if helpers.trace then + if path then + helpers.report("popping %s path from front: %s",tag,path) + else + helpers.report("no %s path to pop",tag) + end + end end helpers.registerpath = registerpath @@ -199,10 +221,22 @@ helpers.registerpath = registerpath function package.extraluapath(...) registerpath("extra lua","lua",extraluapaths,...) end +function package.pushluapath(path) + pushpath("extra lua","lua",extraluapaths,path) +end +function package.popluapath() + poppath("extra lua","lua",extraluapaths) +end function package.extralibpath(...) registerpath("extra lib","lib",extralibpaths,...) end +function package.pushlibpath(path) + pushpath("extra lib","lib",extralibpaths,path) +end +function package.poplibpath() + poppath("extra lib","lua",extralibpaths) +end -- lib loader (used elsewhere) |