PackEntry info disappears when unpacking

Post bugreports for the Windows version here
Sergey
User
User
Posts: 66
Joined: Wed Jan 12, 2022 2:41 pm

PackEntry info disappears when unpacking

Post by Sergey »

Hi, maybe there is already something similar on the forum,
but I just get this case and there is no information about it in PB help

Take PB standard example with packer work
Procedure UncompressPackFile()
Copy example to IDE and replace code at line 23 - 25

Code: Select all

UseZipPacker()

Path$ = #PB_Compiler_Home + "examples/sources/Data/" ; path to the PureBasic examples data/media files
PackFile$ = GetTemporaryDirectory() + "PureBasicTest.zip"  ; path to the pack file which should be created and opened later
If CreatePack(0, PackFile$)
	AddPackFile(0, Path$ + "world.png", "world.png")
	AddPackFile(0, Path$ + "test.pref", "test.pref")
	AddPackFile(0, Path$ + "CdPlayer.ico", "CdPlayer.ico")
	AddPackFile(0, Path$ + "Background.bmp", "Background.bmp")
	ClosePack(0)
	Debug "PackFile successfully created: " + PackFile$
Else
	Debug "Error creating the pack file!"
EndIf

Path$ = GetTemporaryDirectory() + "PureBasicTest/"  ; path to a directory into which the pack files should be extracted
If OpenPack(0, PackFile$)
	If CreateDirectory(Path$) Or FileSize(Path$) = -2
		If ExaminePack(0)
			Debug "Extracting archive into: " + Path$
			While NextPackEntry(0)
				Debug " - name: " + PackEntryName(0) + ", size: " + PackEntrySize(0)
				If UncompressPackFile(0, Path$ + PackEntryName(0), PackEntryName(0)) = -1
					Debug "Error: unsuccessful unpacking of file: " + PackEntryName(0)
				EndIf
			Wend
		EndIf
		ClosePack(0)
		RunProgram(Path$)  ; open the directory with the unpacked files
	Else
		Debug "Error while creating the folder '" + Path$ + "' to unpack the archive contents!"
	EndIf
Else
	Debug "Error opening the pack file!"
EndIf
with

Code: Select all

If UncompressPackFile(0, Path$ + PackEntryName(0), PackEntryName(0)) = -1
	Debug "Error: unsuccessful unpacking of file: " + PackEntryName(0)
Else
	Debug "Done: successful unpacking of file: " + PackEntryName(0)
EndIf
PackEntryName after unpacking = "" and PackEntrySize = -1
It's empty before next PackEntry! Windows x64 PB630b5

I don't try to full disk and make error situation, but I know that PackEntry info will empty too

Make name.s = PackEntryName(0) and size.q = PackEntrySize(0) will help, but it must work as well