Page 18 of 40
Posted: Mon Jun 18, 2007 11:26 am
by gnozal
AL90 wrote:A ReadOnly file packed and with PFM extracted, and the flag is hold.
If I pack it with pureZip the flag will lost. So are flags readable but not
writeable in archive. Thats is what I mean.
Thanks, I understand now.
The only file info I get is in the PureZIP_FileInfo structure.
Maybe the file attributes are in the internal_fa/external_fa members (the ZLIB doc isn't very good ...) ?
Code: Select all
internal_fa.l ; internal file attributes
external_fa.l ; external file attributes
I don't have much time, so could you please test this ?
If it works, I could use this in PureZIP to recreate the original file attributes after extraction.
Posted: Mon Jun 18, 2007 6:51 pm
by AL90
gnozal wrote:If it works, I could use this in PureZIP to recreate the original file attributes after extraction.
I use
external_fa.l to recreate the Attributes after extraction in PFM.
I have testet
internal_fa.l but I think it has no function (?)
Here a small example from my code how I recreate the Attributes after extraction.
Code: Select all
Procedure.l GetFileAttributesZIP(ZipFile$,File$)
ZipNr.l=PureZIP_FindFile(ZipFile$, Right(File$,Len(File$)-5), #True)
PureZIP_GetFileInfo(ZipFile$, ZipNr, @FileInfo.PureZIP_FileInfo)
x.l=FileInfo\external_fa.l
ProcedureReturn x
EndProcedure
...
...
...
SetFileAttributes(...)
Is not the best way, but it works good.
Posted: Mon Jun 18, 2007 7:15 pm
by akj
Hello Gnozal,
Is your PureZip library also available as a language-independent DLL?
Posted: Wed Jun 20, 2007 10:04 am
by gnozal
akj wrote:Hello Gnozal,
Is your PureZip library also available as a language-independent DLL?
Currently no.
Posted: Wed Jun 20, 2007 11:12 am
by gnozal
New beta http://freenet-homepage.de/gnozal/PureZIP_BETA.zip
Changes :
- added function PureZIP_AsciiDosUS_To_AsciiWinWestern() usefull for german users ; thanks to String from the german forum
- added file attributes support : PureZIP now stores the packed files attributes in external_fa.l member of PureZIP_FileInfo and restores the attributes after unpacking.
Please test !
Posted: Wed Jun 20, 2007 8:37 pm
by AL90
gnozal wrote:Please test !
It doesn't work. Only if I adding following lines.:
Code: Select all
FileAttributes=FileInfo\external_fa.l ; Flags nach dem entpacken setzen.
SetFileAttributes(File$,FileAttributes)
I have packed a file with
'ReadOnly & Archived-Flags' and I get as result
"----" (No Flags)
with my two lines on top is the result:
"ra--" (ReadOnly and Archived)
so correct only with these two added code-lines on top.
Posted: Thu Jun 21, 2007 9:57 am
by gnozal
AL90 wrote:It doesn't work.
Seems to works here.
I am using this when I pack the file :
FileInfo\external_fa = GetFileAttributes_(@FileName)
and this after unpacking the file :
SetFileAttributes_(@FileName, FileInfo\external_fa)
Test directory (c:\PureBasic400\Program\ZIP\)
Code: Select all
c:\PureBasic400\Program\ZIP\0.pb 1 538 18/06/07 13:49 ----
c:\PureBasic400\Program\ZIP\A.pb 1 538 18/06/07 13:49 -a--
c:\PureBasic400\Program\ZIP\H.pb 1 538 18/06/07 13:49 --h-
c:\PureBasic400\Program\ZIP\R.pb 1 538 18/06/07 13:49 r---
c:\PureBasic400\Program\ZIP\RA.pb 1 538 18/06/07 13:49 ra--
c:\PureBasic400\Program\ZIP\S.pb 1 538 18/06/07 13:49 ---s
Test code
Code: Select all
myFileinfo._PureZIP_FileInfo
MyZIP.s = "c:\PureBasic400\Program\ZIP\TestFile.zip"
If PureZIP_Archive_Create(MyZIP, #APPEND_STATUS_CREATE)
PureZIP_Archive_Compress("c:\PureBasic400\Program\ZIP\0.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Program\ZIP\A.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Program\ZIP\RA.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Program\ZIP\R.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Program\ZIP\H.pb", #False)
PureZIP_Archive_Compress("c:\PureBasic400\Program\ZIP\S.pb", #False)
PureZIP_Archive_Close()
EndIf
If PureZIP_Archive_Read(MyZIP)
Found = PureZIP_Archive_FindFirst()
While Found = #UNZ_OK
Info = PureZIP_Archive_FileInfo(@myFileinfo)
Debug "INFO ---"
Debug myFileinfo\FileName
Debug myFileinfo\external_fa.l
PureZIP_Archive_Extract("c:\PureBasic400\Program\ZIP2", #False)
Found = PureZIP_Archive_FindNext()
Wend
PureZIP_Archive_Close()
EndIf
End
Debug Output
Code: Select all
INFO ---
0.pb
128
INFO ---
A.pb
32
INFO ---
RA.pb
33
INFO ---
R.pb
1
INFO ---
H.pb
2
INFO ---
S.pb
4
Unpacked files (in c:\PureBasic400\Program\ZIP2\)
Code: Select all
c:\PureBasic400\Program\ZIP2\0.pb 1 538 18/06/07 13:49 ----
c:\PureBasic400\Program\ZIP2\A.pb 1 538 18/06/07 13:49 -a--
c:\PureBasic400\Program\ZIP2\H.pb 1 538 18/06/07 13:49 --h-
c:\PureBasic400\Program\ZIP2\R.pb 1 538 18/06/07 13:49 r---
c:\PureBasic400\Program\ZIP2\RA.pb 1 538 18/06/07 13:49 ra--
c:\PureBasic400\Program\ZIP2\S.pb 1 538 18/06/07 13:49 ---s
So it's ok here !?
Posted: Thu Jun 21, 2007 5:50 pm
by AL90
Hello gnozal,
I have test it again and it works now fine. Possibly I have it use bad to my first try. Sorry.
I think I forgot to restart jaPBe after replace the new PureZIP lib.
BTW:
I have now remove all
Set/GetFileAttributes from my code and it works also without fine.
Thanks for the good job.

Posted: Fri Jun 22, 2007 10:50 am
by gnozal
Update (Both libs)
Changes :
- added function PureZIP_AsciiDosUS_To_AsciiWinWestern() usefull for german users ; thanks to String from the german forum
- added file attributes support : PureZIP now stores the packed files attributes in external_fa.l member of PureZIP_FileInfo and restores the attributes after unpacking.
Posted: Thu Jun 28, 2007 3:43 pm
by Sveinung
Is there a size limit to this lib? I get a lot of errors when files are above 1 Gb
Regards
Sveinung
Posted: Fri Jun 29, 2007 9:41 am
by gnozal
Sveinung wrote:Is there a size limit to this lib? I get a lot of errors when files are above 1 Gb
What errors ?
ZLIB has a 2 Gb archive size limit. The PB file functions can handle files up to 2^64 bytes if the filesystem supports it.
Posted: Fri Jun 29, 2007 9:50 am
by Sveinung
When I create large archives (+- 1 Gb) the archives usealy comes up empty, but the filesize of the archive looks ok. I also get a lot of crc errors whe n making archives with PureZIP_AddFiles(). Lots of files missing to.
Regards
Sveinung
Posted: Fri Jun 29, 2007 9:57 am
by gnozal
Sveinung wrote:When I create large archives (+- 1 Gb) the archives usealy comes up empty, but the filesize of the archive looks ok. I also get a lot of crc errors whe n making archives with PureZIP_AddFiles(). Lots of files missing to.
Try working with the PureZIP_Archive_* functions. And check if they are returning any error(s).
Posted: Sun Jul 08, 2007 9:25 am
by Inf0Byt3
Gnozal, shouldn't Zlib read/write GZip files too? Can you make PureZIP support gzip too or is it too hard?
Posted: Mon Jul 09, 2007 7:59 am
by gnozal
Inf0Byt3 wrote:Gnozal, shouldn't Zlib read/write GZip files too? Can you make PureZIP support gzip too or is it too hard?
Yes, with ZLIB you can handle gzip files, but it's another set of functions : have a look at the gz* functions in zlib.h (for PureZIP I only used the zip*/unz* functions).
So it's possible, but it's a whole new set of functions, almost a new library.
Have a look at this thread (german forum) :
http://www.purebasic.fr/german/viewtopic.php?t=10088 Maybe it helps ?