Page 5 of 40

Posted: Thu Dec 15, 2005 8:00 pm
by zikitrake
:( another bug

If you have a zip file with 2 files with the same name in differents directories,

For example, you have this tree directory

c:\test\text.txt
c:\test\dir1\text.txt

Code: Select all

Searchfile1.s = "c:\test\text.txt"
ReturnValue1.l = PureZIP_FindFile(ZIPFile$, SearchFile1)

Searchfile2.s = "c:\test\dir1\text.txt"
ReturnValue2.l = PureZIP_FindFile(ZIPFile$, SearchFile2)
ReturnValue1 and ReturnValue2 have the same value (I think it only search for filename without path)

And I would like that

Code: Select all

PureZIP_Archive_Locate()
can Returns file number in archive or add the command

Code: Select all

PureZIP_Archive_FindFile(FileToSearch.s)
(is this possible?)

Thank you!!

Posted: Fri Dec 16, 2005 8:41 am
by gnozal
Update

Changes
- Fixed archived file date bug
- Fixed some errors in help files and improved documentation

Posted: Fri Dec 16, 2005 8:44 am
by gnozal
@zikitrake : I will see what I can do.

Posted: Fri Dec 16, 2005 9:12 am
by zikitrake
gnozal wrote:@zikitrake : I will see what I can do.
Very thank you for your effort!

Posted: Fri Dec 16, 2005 9:18 am
by gnozal
If you have a zip file with 2 files with the same name in differents directories,
ReturnValue1 and ReturnValue2 have the same value (I think it only search for filename without path)
Yes, I search only for the filename.
I will add an option to search for the full path.
And I would like that PureZIP_Archive_Locate() returns file number in archive
I simply use the ZLIB unzLocateFile() function wich does not work that way.
And PureZIP_Archive_Locate() is intended to work like the other PureZIP_Archive_*() functions, ie with current file in archive.

But you can do your own FindFileInZIP() function :
- open archive with PureZIP_Archive_Read()
- scan the archive with the PureZIP_Archive_FindFirst() / PureZIP_Archive_FindNext() functions
- and get the file info (including Filename) with PureZIP_Archive_FileInfo
- do what you have to do with the FileName
- close archive with PureZIP_Archive_Close()

Posted: Fri Dec 16, 2005 9:45 am
by zikitrake
gnozal wrote:
And I would like that PureZIP_Archive_Locate() returns file number in archive
I simply use the ZLIB unzLocateFile() function wich does not work that way.
And PureZIP_Archive_Locate() is intended to work like the other PureZIP_Archive_*() functions, ie with current file in archive.

But you can do your own FindFileInZIP() function :
- open archive with PureZIP_Archive_Read()
- scan the archive with the PureZIP_Archive_FindFirst() / PureZIP_Archive_FindNext() functions
- and get the file info (including Filename) with PureZIP_Archive_FileInfo
- do what you have to do with the FileName
- close archive with PureZIP_Archive_Close()
;) yes, actually I use this method. Thank you

Posted: Fri Dec 16, 2005 9:57 am
by gnozal
Update

Changes :
- New parameter IncludingPath.l for function PureZIP_FindFile()

Posted: Fri Dec 16, 2005 12:53 pm
by zikitrake
gnozal wrote:Update

Changes :
- New parameter IncludingPath.l for function PureZIP_FindFile()
It Works fine. Thank you

Posted: Mon Mar 20, 2006 3:37 pm
by webbmeister
Can anyone supply sample usage to Zip a single file for use with Version 4 Beta 7 ?

Posted: Mon Mar 20, 2006 5:20 pm
by gnozal
webbmeister wrote:Can anyone supply sample usage to Zip a single file for use with Version 4 Beta 7 ?
Example with DLL : http://www.purebasic.fr/english/viewtopic.php?t=20370 (see Num3 PB_ZIP post)

Posted: Mon Mar 20, 2006 5:58 pm
by webbmeister
That link is a little hard to follow. I have downloaded "purezip.zip" and expanded that into my purebasicbeta program folder. Could someone give me some code to try in v4b7 to zip say c:\test.txt to c:\test.zip.

Posted: Tue Mar 21, 2006 8:45 am
by gnozal
webbmeister wrote:That link is a little hard to follow. I have downloaded "purezip.zip" and expanded that into my purebasicbeta program folder. Could someone give me some code to try in v4b7 to zip say c:\test.txt to c:\test.zip.
Maybe the best is to go to Num3's site http://io-soft.planetaclix.pt/software.htm and download his Zlib Procedures http://io-soft.planetaclix.pt/files/Zlib_Procedures.zip

Posted: Tue Mar 21, 2006 10:19 am
by webbmeister
gnozal wrote:
webbmeister wrote:That link is a little hard to follow. I have downloaded "purezip.zip" and expanded that into my purebasicbeta program folder. Could someone give me some code to try in v4b7 to zip say c:\test.txt to c:\test.zip.
Maybe the best is to go to Num3's site http://io-soft.planetaclix.pt/software.htm and download his Zlib Procedures http://io-soft.planetaclix.pt/files/Zlib_Procedures.zip
Maybe it's me been a bit slow, but can't seem to find any usage docs on the website or in the zip file. Maybe some kind soul could provide an example?

Posted: Tue Mar 21, 2006 10:26 am
by gnozal
webbmeister wrote:
gnozal wrote:
webbmeister wrote:That link is a little hard to follow. I have downloaded "purezip.zip" and expanded that into my purebasicbeta program folder. Could someone give me some code to try in v4b7 to zip say c:\test.txt to c:\test.zip.
Maybe the best is to go to Num3's site http://io-soft.planetaclix.pt/software.htm and download his Zlib Procedures http://io-soft.planetaclix.pt/files/Zlib_Procedures.zip
Maybe it's me been a bit slow, but can't seem to find any usage docs on the website or in the zip file. Maybe some kind soul could provide an example?
From Zlib.pb in Zlib_Procedures.zip :

Code: Select all

  If ZIP_Lib_Init()
    
    
    ;****  Create Zip File **********
    
    file.s=SaveFileRequester("Select a Zip Filename to save","*.zip","*.zip",1)
    
    If file
      add_file.s=OpenFileRequester("Select File to Add","*.*","*.*",1)
      
      If add_file
        
        Handle.l=ZIP_FileCreate(file,#APPEND_STATUS_CREATE)
        
        If Handle
          
          If ZIP_FileAdd(Handle,add_file,GetFilePart(add_file))
            
            Debug "File Added to Archive..."
            
          EndIf
          ZIP_FileClose(Handle)
          
        EndIf
        
      EndIf
      
      
    EndIf
    
    ; **** Extract Zip file **********
    
    file.s=OpenFileRequester("Select a Zip","*.zip","*.zip",1)
    
    If file
      
      myFileinfo.unz_file_info
      
      count.l=ZIP_FileCount(file)
      Debug "This zip has " + Str(count) + " itens"
      
      out_path.s=PathRequester("Extracto to:" ,"c:\temp")
      For a=0 To count-1
        
        ZIP_GetFileInfo(file,a,@myFileinfo)
        Filesize.l=myFileinfo\uncompressed_size
        
        If Filesize>0
          
          Debug "Filename: " + myFileinfo\FileName
          Debug "Compressed Size: " + Str(myFileinfo\compressed_size)
          Debug "Uncompressed Size: "+ Str(Filesize)
          
          If ZIP_ExtractFile(file,a,out_path,#False)
            Debug "File Extracted"
          EndIf
          Debug "***************"
          
        Else
          Debug "Directory: " + myFileinfo\FileName
          Debug "***************"
        EndIf
        
      Next
      
    EndIf
    
    
    
    ZIP_Lib_Stop()
  EndIf
  End

Posted: Tue Mar 21, 2006 2:09 pm
by webbmeister

Code: Select all

Structure tm_date
  tm_sec.l;            /* seconds after the minute - [0,59] */
  tm_min.l;            /* minutes after the hour - [0,59] */
  tm_hour.l;           /* hours since midnight - [0,23] */
  tm_mday.l;           /* day of the month - [1,31] */
  tm_mon.l;            /* months since January - [0,11] */
  tm_year.l;           /* years - [1980..2044] */
EndStructure
Found the zip.pb example at last.
Using zip.pb (Num 3) on PB4B7 i get the following error message when I try to compile.....

[COMPILER] Line 34: 'Structure' or 'Interface' already declared: tm_date


any ideas?