summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/context/base/data-zip.lua
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/context/base/data-zip.lua')
-rw-r--r--Master/texmf-dist/tex/context/base/data-zip.lua62
1 files changed, 31 insertions, 31 deletions
diff --git a/Master/texmf-dist/tex/context/base/data-zip.lua b/Master/texmf-dist/tex/context/base/data-zip.lua
index 5db69670c6d..2be88e0fc1c 100644
--- a/Master/texmf-dist/tex/context/base/data-zip.lua
+++ b/Master/texmf-dist/tex/context/base/data-zip.lua
@@ -6,7 +6,7 @@ if not modules then modules = { } end modules ['data-zip'] = {
license = "see context related readme files"
}
--- partly redone .. needs testing
+-- real old code ... partly redone .. needs testing due to changes as well as a decent overhaul
local format, find, match = string.format, string.find, string.match
@@ -37,18 +37,6 @@ local archives = zip.archives
zip.registeredfiles = zip.registeredfiles or { }
local registeredfiles = zip.registeredfiles
-local limited = false
-
-directives.register("system.inputmode", function(v)
- if not limited then
- local i_limiter = io.i_limiter(v)
- if i_limiter then
- zip.open = i_limiter.protect(zip.open)
- limited = true
- end
- end
-end)
-
local function validzip(str) -- todo: use url splitter
if not find(str,"^zip://") then
return "zip:///" .. str
@@ -64,7 +52,7 @@ function zip.openarchive(name)
local arch = archives[name]
if not arch then
local full = resolvers.findfile(name) or ""
- arch = (full ~= "" and zip.open(full)) or false
+ arch = full ~= "" and zip.open(full) or false
archives[name] = arch
end
return arch
@@ -235,30 +223,42 @@ function resolvers.usezipfile(archive)
end
function resolvers.registerzipfile(z,tree)
- local files, filter = { }, ""
- if tree == "" then
- filter = "^(.+)/(.-)$"
- else
- filter = format("^%s/(.+)/(.-)$",tree)
- end
+ local names = { }
+ local files = { } -- somewhat overkill .. todo
+ local remap = { } -- somewhat overkill .. todo
+ local n = 0
+ local filter = tree == "" and "^(.+)/(.-)$" or format("^%s/(.+)/(.-)$",tree)
+ local register = resolvers.registerfile
if trace_locating then
report_zip("registering: using filter %a",filter)
end
- local register, n = resolvers.registerfile, 0
for i in z:files() do
- local path, name = match(i.filename,filter)
- if path then
- if name and name ~= '' then
- register(files, name, path)
- n = n + 1
- else
- -- directory
+ local filename = i.filename
+ local path, name = match(filename,filter)
+ if not path then
+ n = n + 1
+ register(names,filename,"")
+ local usedname = lower(filename)
+ files[usedname] = ""
+ if usedname ~= filename then
+ remap[usedname] = filename
end
- else
- register(files, i.filename, '')
+ elseif name and name ~= "" then
n = n + 1
+ register(names,name,path)
+ local usedname = lower(name)
+ files[usedname] = path
+ if usedname ~= name then
+ remap[usedname] = name
+ end
+ else
+ -- directory
end
end
report_zip("registering: %s files registered",n)
- return files
+ return {
+ -- metadata = { },
+ files = files,
+ remap = remap,
+ }
end