made unarchive actually able to un-archive files
This commit is contained in:
parent
f92cbde89b
commit
33477c7528
@ -23,7 +23,28 @@ while true do
|
|||||||
end
|
end
|
||||||
local name = fi:read(nlen)
|
local name = fi:read(nlen)
|
||||||
local fsize = toint(fi:read(2))
|
local fsize = toint(fi:read(2))
|
||||||
local fcontent = fi:read(fsize)
|
if not tArgs[2] then
|
||||||
|
local dir = name:match("(.+)/.*%.?.+")
|
||||||
|
if (dir) then
|
||||||
|
os.execute("mkdir "..dir.." &> /dev/null")
|
||||||
|
end
|
||||||
|
local f = io.open(name,"wb")
|
||||||
|
local rsize,buf = fsize, ""
|
||||||
|
if f then
|
||||||
|
repeat
|
||||||
|
buf = fi:read(math.min(rsize,1024))
|
||||||
|
f:write(buf)
|
||||||
|
rsize = rsize - buf:len()
|
||||||
|
until rsize <= 1
|
||||||
|
f:close()
|
||||||
|
end
|
||||||
|
else
|
||||||
|
local rsize = fsize
|
||||||
|
repeat
|
||||||
|
buf = fi:read(math.min(rsize,1024))
|
||||||
|
rsize = rsize - buf:len()
|
||||||
|
until rsize <= 1
|
||||||
|
end
|
||||||
print(name,fsize)
|
print(name,fsize)
|
||||||
end
|
end
|
||||||
fi:close()
|
fi:close()
|
||||||
|
Loading…
Reference in New Issue
Block a user