3333--- @param x table The list of files in the zip to not extract
3434function unzip (z , d , l , x )
3535
36- -- TODO: implement lists
37-
3836 -- C = Read chunk size
3937 -- v = System path seperator/Version needed
4038 -- f = File
@@ -53,6 +51,7 @@ function unzip(z, d, l, x)
5351 -- us = Uncompressed size
5452 -- nl = Length of file name
5553 -- el = Extra length in the file name
54+ -- fn = File name
5655 -- of = Output file
5756 -- re = Remaining bytes
5857 -- ec = Expected crc32 checksum
@@ -63,6 +62,19 @@ function unzip(z, d, l, x)
6362 fn , E = f :read (nl ) D () -- read the filename
6463 if el > 0 then f :seek (" cur" , el ) end
6564
65+ if x then -- Skip file if it's on the exclude list
66+ for _ , i in ipairs (x ) do if i == fn then goto L end end
67+ end
68+
69+ if l then -- Skip file if it's not on the include list
70+
71+ -- j = file found in list
72+ local j
73+
74+ for _ , i in ipairs (l ) do if i == fn then j = 1 break end end
75+ if not j then goto L end
76+ end
77+
6678 re = cs
6779
6880 --- Create all required directories in a path up to a file.
@@ -124,6 +136,7 @@ function unzip(z, d, l, x)
124136
125137 if ec ~= cr then print (" !CRC" ) end
126138 end
139+ :: L:: -- Jump to the end of the loop to iterate again
127140 end
128141
129142 f :close ()
0 commit comments