diff options
author | Marius <mariausol@gmail.com> | 2010-09-29 10:24:24 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2010-09-29 10:24:24 +0300 |
commit | 85da9cc1275f6f47ab6ab41938c386b024a25e0b (patch) | |
tree | e27712ba3b341e7e006282cc7a48e6200717ef29 /tex/context/base/mlib-run.lua | |
parent | 1daa5350b249e633033662735b5615e24a48377a (diff) | |
download | context-85da9cc1275f6f47ab6ab41938c386b024a25e0b.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) |