summaryrefslogtreecommitdiff
path: root/tex/context/base/data-ctx.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/data-ctx.lua')
-rw-r--r--tex/context/base/data-ctx.lua34
1 files changed, 22 insertions, 12 deletions
diff --git a/tex/context/base/data-ctx.lua b/tex/context/base/data-ctx.lua
index 89eb2742d..47f9c527e 100644
--- a/tex/context/base/data-ctx.lua
+++ b/tex/context/base/data-ctx.lua
@@ -8,24 +8,34 @@ if not modules then modules = { } end modules ['data-ctx'] = {
local format = string.format
-function resolvers.save_used_files_in_trees(filename,jobname)
- if not filename then filename = 'luatex.jlg' end
- local found = instance.foundintrees
+local report_resolvers = logs.new("resolvers")
+
+function resolvers.save_used_files_in_trees()
+ local jobname = environment.jobname
+ if not jobname or jobname == "" then jobname = "luatex" end
+ local filename = file.replacesuffix(jobname,'jlg')
local f = io.open(filename,'w')
if f then
f:write("<?xml version='1.0' standalone='yes'?>\n")
f:write("<rl:job>\n")
- if jobname then
- f:write(format("\t<rl:name>%s</rl:name>\n",jobname))
- end
- f:write("\t<rl:files>\n")
+ f:write(format("\t<rl:jobname>%s</rl:jobname>\n",jobname))
+ f:write(format("\t<rl:contextversion>%s</rl:contextversion>\n",environment.version))
+ local found = resolvers.instance.foundintrees
local sorted = table.sortedkeys(found)
- for k=1,#sorted do
- local v = sorted[k]
- f:write(format("\t\t<rl:file n='%s'>%s</rl:file>\n",found[v],v))
+ if #sorted > 0 then
+ f:write("\t<rl:files>\n")
+ for k=1,#sorted do
+ local v = sorted[k]
+ f:write(format("\t\t<rl:file n='%s'>%s</rl:file>\n",found[v],v))
+ end
+ f:write("\t</rl:files>\n")
+ else
+ f:write("\t<rl:files/>\n")
end
- f:write("\t</rl:files>\n")
- f:write("</rl:usedfiles>\n")
+ f:write("</rl:job>\n")
f:close()
+ report_resolvers("saving used tree files in '%s'",filename)
end
end
+
+directives.register("system.dumpfiles", function() resolvers.save_used_files_in_trees() end)