The documentation for NextPackEntry() says:
Return value: Nonzero if the pack contain another entry, zero otherwise.
This also makes sense. This is how such works. So it returns 0 if no further entry exists.
But this code proofs that wrong:
Code: Select all
UseZipPacker()
infile.s = GetTemporaryDirectory()+"testfile.txt"
outfile.s = GetTemporaryDirectory()+"testfile.zip"
If OpenFile(0, infile.s)
WriteStringN(0, "Some test content for ZIP archive test")
CloseFile(0)
EndIf
; create a zip file
hZip = CreatePack(#PB_Any, outfile)
ret = AddPackFile(hZip, infile, GetFilePart(infile))
ClosePack(hZip)
; open the zip file
hZip = OpenPack(#PB_Any, outfile)
If ExaminePack(hZip)
Repeat
ret = NextPackEntry(hZip) ; DOCS: Returns nonzero if the pack contains another entry, zero otherwise.
Debug "Ret: " + str(ret) + " Name: " + PackEntryName(hZip) + ", Size: " + PackEntrySize(hZip)
Until ret = 0
EndIf
ClosePack(hZip)
DeleteFile(infile.s)
DeleteFile(outfile.s)
Code: Select all
Ret: 1 Name: testfile.txt, Size: 40
Ret: 0 Name: , Size: 0
I tested this on Windows 10 with PB 5.71, PB 5.73 and PB 6.00 beta6. All are affected the same way.
Is this really a bug or did I missunderstood something here?