diff options
author | Marius <mariausol@gmail.com> | 2011-09-05 21:00:14 +0300 |
---|---|---|
committer | Marius <mariausol@gmail.com> | 2011-09-05 21:00:14 +0300 |
commit | 0fcfc1315db811fe124104d1e7759c4f79c67f43 (patch) | |
tree | bb8b7f02e8b53688065055234a74eb88aa2a646f /tex/context/base/mlib-run.lua | |
parent | e79e4cafd297a82d6cecbb5a3329e2d69ae4cfe8 (diff) | |
download | context-0fcfc1315db811fe124104d1e7759c4f79c67f43.tar.gz |
beta 2011.09.05 19:28
Diffstat (limited to 'tex/context/base/mlib-run.lua')
-rw-r--r-- | tex/context/base/mlib-run.lua | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/tex/context/base/mlib-run.lua b/tex/context/base/mlib-run.lua index 900f466e2..f8c0456a1 100644 --- a/tex/context/base/mlib-run.lua +++ b/tex/context/base/mlib-run.lua @@ -224,7 +224,7 @@ else if not mpx then result = { status = 99, error = "out of memory"} else - result = mpx:execute(format(preamble, file.replacesuffix(name,"mp"))) + result = mpx:execute(format(preamble, file.addsuffix(name,"mp"))) end stoptiming(mplib) metapost.reporterror(result) @@ -233,14 +233,31 @@ else function metapost.checkformat(mpsinput) local mpsversion = environment.version or "unset version" - local mpsinput = file.addsuffix(mpsinput or "metafun", "mp") - report_metapost("loading '%s' (experimental metapost version two)",mpsinput) - local mpx, result = metapost.load(mpsinput) - if mpx then - return mpx + local mpsinput = mpsinput or "metafun" + local foundfile = "" + if file.suffix(mpsinput) ~= "" then + foundfile = finder(mpsinput) or "" + end + if foundfile == "" then + foundfile = finder(file.replacesuffix(mpsinput,"mpvi")) or "" + end + if foundfile == "" then + foundfile = finder(file.replacesuffix(mpsinput,"mpiv")) or "" + end + if foundfile == "" then + foundfile = finder(file.replacesuffix(mpsinput,"mp")) or "" + end + if foundfile == "" then + report_metapost("loading '%s' fails, format not found",mpsinput) else - report_metapost("error in loading '%s'",mpsinput) - metapost.reporterror(result) + report_metapost("loading '%s': %s",mpsinput,foundfile) + local mpx, result = metapost.load(foundfile) + if mpx then + return mpx + else + report_metapost("error in loading '%s'",mpsinput) + metapost.reporterror(result) + end end end |