B4J Question Unzip under Linux

peacemaker

Expert
Licensed User
Longtime User
Hi, All

What ZIP lib better for Linux ? To unzip whole folder\subfolders...
I used ABZipUnzip lib v.1.0 under Windows in B4A and B4J - with no problem, like:
B4X:
Sub Unzip_File (folder1 As String, fn As String, toFolder As String) As List
    'others.Unzip_File(File.DirApp, "1.zip", File.Combine(File.DirApp, "logs"))
    Dim L As List
    L.Initialize
    Try
        Dim zip As ABZipUnzip
        Dim zipContent As ABZipContent, counter As Int
        counter = zip.ABListZip(File.Combine(folder1, fn))   'error here
        If counter > 0 Then
            For i = 0 To counter - 1
                zipContent = zip.ABGetListItem(i)
                L.Add(zipContent.Name)
            Next
            zip.ABUnzip(File.Combine(folder1, fn), toFolder)
        End If
    Catch
        Log("Wrong ZIP: " & fn)
    End Try
    Return L
End Sub
But under Linux it gives error (not fatal, code runs further) at content listing (zip.ABListZip):
IOError :java.util.zip.ZipException: zip END header not found

Any suggestion ?
 

peacemaker

Expert
Licensed User
Longtime User
ArchiverPlusZip lib also gives under Linux the same error:
a.a.a.c.a: zip headers not found. probably not a zip file

But manually by TotalCommander all is unpacked OK, and content is full.
 
Upvote 0

peacemaker

Expert
Licensed User
Longtime User
These zip-files (that cannot be unzipped by our B4x libs) are made by Phyton software, by default built-in lib "zipfile". If i make a ZIP-file by TotalCommander manually - it unzipped OK under Win and under Linux also.
But TotalCommander can unzip also and these trouble files...
 
Upvote 0

teddybear

Well-Known Member
Licensed User
These zip-files (that cannot be unzipped by our B4x libs) are made by Phyton software, by default built-in lib "zipfile". If i make a ZIP-file by TotalCommander manually - it unzipped OK under Win and under Linux also.
But TotalCommander can unzip also and these trouble files...
You can use java.util.zip package to implement extracting folder.

 
Last edited:
Upvote 0
Top