From f0fb5ff776f4429a80c214cca1e335fdcfa0fe77 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Thu, 25 Jun 2020 09:33:22 +1000 Subject: [PATCH] removed unarchive from the mtar library, wasn't meant to be in there anyway --- lib/libmtar.lua | 54 ------------------------------------------------- 1 file changed, 54 deletions(-) diff --git a/lib/libmtar.lua b/lib/libmtar.lua index 0da8f7d..3484a47 100644 --- a/lib/libmtar.lua +++ b/lib/libmtar.lua @@ -1,24 +1,5 @@ local mtar = {} --- detect OS hopefully -if _OSVERSION then - if _OSVERSION:sub(1,8) == "OpenOS" then - OPENOS = true - elseif _OSVERSION:sub(1,9) == "PsychOS" then - PSYCHOS = true - end -else - LINUX = true -end - -local function mkdir(dir) - if OPENOS or LINUX then - os.execute("mkdir "..dest.."/"..dir.." &> /dev/null") - elseif PSYCHOS then - -- todo: write PsychOS support - end -end - local function toint(s) local n = 0 local i = 1 @@ -74,39 +55,4 @@ function mtar.iter(stream) -- table -- function -- Given buffer *stream*, return end end -function mtar.unarchive(stream,dest,verbose) -- Extract mtar archive read from *stream* to *dest*. If *verbose*, print status. - dest = dest or "." - while true do - local nlen = toint(stream:read(2) or "\0\0") - if nlen == 0 then - break - end - local name = cleanPath(stream:read(nlen)) - local fsize = toint(stream:read(2)) - if verbose then - io.write(name.." "..tostring(fsize).."... ") - end - local dir = name:match("(.+)/.*%.?.+") - if (dir) then - mkdir(dir) - end - local f = io.open(dest.."/"..name,"wb") - local rsize,buf = fsize, "" - if f then - repeat - buf = stream:read(math.min(rsize,2048)) - f:write(buf) - rsize = rsize - buf:len() - if verbose then - io.write(tostring(rsize).." ") - end - until rsize <= 1 - f:close() - end - if verbose then - print("done.") - end - end -end - return mtar