From 44c88089e97e7621d86921cb06aa7e3795f0ad33 Mon Sep 17 00:00:00 2001 From: Hans Hagen Date: Tue, 28 Sep 2010 23:57:00 +0200 Subject: beta 2010.09.28 23:57 --- tex/context/base/mlib-run.lua | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'tex/context/base/mlib-run.lua') diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua index fc993861c..7d670b77d 100644 --- a/tex/context/base/mlib-run.lua +++ b/tex/context/base/mlib-run.lua @@ -35,7 +35,7 @@ local report_mplib = logs.new("mplib") local texerrormessage = logs.texerrormessage -local format, gsub, match = string.format, string.gsub, string.match +local format, gsub, match, find = string.format, string.gsub, string.match, string.find local starttiming, stoptiming = statistics.starttiming, statistics.stoptiming @@ -57,8 +57,8 @@ function metapost.resetlastlog() metapost.lastlog = "" end -local function finder(name, mode, ftype) - if mode=="w" then +local function finder(name, mode, ftype) -- we can use the finder to intercept btex/etex + if mode == "w" then return name elseif file.is_qualified_path(name) then return name @@ -67,6 +67,23 @@ local function finder(name, mode, ftype) end end +local function finder(name, mode, ftype) -- we use the finder to intercept btex/etex + if mode ~= "w" then + name = file.is_qualified_path(name) and name or resolvers.findfile(name,ftype) + if not (find(name,"/metapost/context/base/") or find(name,"/metapost/context/") or find(name,"/metapost/base/")) then + local data, found, forced = metapost.checktexts(io.loaddata(name) or "") + if found then + local temp = luatex.registertempfile(name) + io.savedata(temp,data) + name = temp + end + end + end + return name +end + +-- -- -- + metapost.finder = finder function metapost.reporterror(result) -- cgit v1.2.3