As a newbie, I'm unsure if this is a bug or my inexperience.
EDIT - now tested on Windows and works OK, so I'm confident that it IS a bug
I'm running PureBasic 5.73 LTS (MacOS X - x64) on macOS Big Sur 11.4 on a Mac mini (M1, 2020)
In the following code PackEntryName(0) returns only the first letter of the file to be uncompressed, and therefore never actually decompresses anything. File size looks OK.
macOS Debug looks like this;
/Users/minim1/PureBasic/Archive4.zip
/Users/minim1/PureBasic/test_unzip/
1 Name e Size 2542775 Type 0 D&F /Users/minim1/PureBasic/test_unzip/
2 Name a Size 5096673 Type 0 D&F /Users/minim1/PureBasic/test_unzip/
3 Name b Size 6241755 Type 0 D&F /Users/minim1/PureBasic/test_unzip/
4 Name c Size 3563622 Type 0 D&F /Users/minim1/PureBasic/test_unzip/
5 Name d Size 3134203 Type 0 D&F /Users/minim1/PureBasic/test_unzip/
The test archive was created using Finder to ensure that there were no incompatibility issues.
This code works on the same .ZIP under Windows 10
Debug shows different behaviour;
C:\Users\Admin\OneDrive\Documents\PureBasic\Archive4.zip
C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
1 Name egg.jpg Size 2542775 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
2 Name __MACOSX/._egg.jpg Size 183 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
3 Name atest.jpg Size 5096673 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
4 Name __MACOSX/._atest.jpg Size 183 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
5 Name bgfgf.jpg Size 6241755 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
6 Name __MACOSX/._bgfgf.jpg Size 183 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
7 Name cnhnh.jpg Size 3563622 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
8 Name __MACOSX/._cnhnh.jpg Size 183 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
9 Name dasf.jpg Size 3134203 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
10 Name __MACOSX/._dasf.jpg Size 183 Type 0 D&F C:\Users\Admin\OneDrive\Documents\PureBasic\test_unzip/
Code: Select all
zipfilelocation$ = OpenFileRequester("Choose a Zip", "", "", 0)
If zipfilelocation$ =""
Text$ + "No File Chosen"
MessageRequester("Information", Text$)
Else
UseZipPacker()
destfolder$ = GetCurrentDirectory()+ "test_unzip/"
CreateDirectory(destfolder$ )
Debug zipfilelocation$
Debug destfolder$
OpenPack(0, zipfilelocation$)
ExaminePack(0)
While NextPackEntry(0)
Result = UncompressPackFile(0, destfolder$ + PackEntryName(0) )
n=n+1
Test$=StrF(n) +" Name " +PackEntryName(0) + " Size "+ PackEntrySize(0) + " Type "+ PackEntryType(0) +" D&F "+destfolder$ + filename$
Debug Test$
Wend
ClosePack(0)
EndIf/code]