diff options
author | Hans Hagen <pragma@wxs.nl> | 2010-09-28 23:57:00 +0200 |
---|---|---|
committer | Hans Hagen <pragma@wxs.nl> | 2010-09-28 23:57:00 +0200 |
commit | 44c88089e97e7621d86921cb06aa7e3795f0ad33 (patch) | |
tree | 4bff2babd03d358f553b4b41da2faa705f5e256e /tex/context/base/mlib-run.lua | |
parent | 6be6b85842e5027105f94f68fc9799c5bb700bb1 (diff) | |
download | context-44c88089e97e7621d86921cb06aa7e3795f0ad33.tar.gz |
beta 2010.09.28 23:57
Diffstat (limited to 'tex/context/base/mlib-run.lua')
-rw-r--r-- | tex/context/base/mlib-run.lua | 23 |
1 files changed, 20 insertions, 3 deletions
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) |