Indigo Rose Software

Professional Software Development Tools

 
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2004
    Location
    Australia
    Posts
    33

    Lightbulb Existing Issues with Zip.Add

    Hey all,

    I've just spent the greater part of the day discovering some issues with the Zip.Add function. For those who are unaware of the weird things that happen with the Zip.Add function, heres a summary:

    1. Store pathnames will only store relative pathnames not absolute. From trawling through the forum I've discovered this was changed between v5.0.0.3 and v5.0.0.4. It can be worked around if you're after absolute filenames but only when you're extracting. Might be easier to replace this functionality thus making it comparable with WinZip etc.
    2. It will not archive/compress any file whose attribute is set to 'Hidden'. Haven't tested this with the 'System' attribute but believe it might also miss these.
    3. As stated elsewhere in the forums, the Filename variable that the Zip.Add function passes to the callback function, contains information which is undocumented. The information passed occurs in the following order:

    Processing Item List... Please wait.
    Item 1 of 20
    Item 2 of 20
    Viper/040627 - 122401.zip
    etc...

    Obviously, the no. of items will depend on how many files and directories you are archiving. Yep, you saw it, the max count (in the example this is 20) also includes any recursed directories!!! In my example, there was 1 directory and 19 files (although the directory did contain another 2 hidden files).

    Wonder how I came across these? Essentially, to count the number of files processed and update them via a call back function, you need to know how many files you are processing to begin with. The easiest way to do this was via the File.Find function. Note, though, that this function includes ALL files (yep, hidden ones etc) and directories if you tell it too. So if you count the files in this table using Table.Count your figure will be different than that calculated by the Zip.Add function.

    If you're interested, I finally wrote this bit of code to strip the current file out of the Filename variable that is passed to the callback function. Although the answer is pretty straight forward, it wasn't easy to get to!

    Code:
    -- UpdateProgress function
    function UpdateProgress(Filename, Percent)
    if String.Compare(String.Left(Filename,4), "Item") == 0 then
      CurrentFile = String.ToNumber(String.Mid(Filename,6,2));    
    else
      CurrentFile = nil
    end
      if CurrentFile ~= nil then
        Label.SetText("Label5", "Overall File Progress... ("..CurrentFile.."/"..TotalFiles..")");
      end
    end
    Next thing I'll do is add the code to strip the max. file count and use it instead of File.Find and Table.Count. THat way, TotalFiles (see code above), will be accurate.

    Hope this helps all!

    SRJ.

  2. #2
    Corey is offline Indigo Rose Staff Alumni
    Join Date
    Aug 2002
    Posts
    9,746
    Nice post!

    Corey Milner
    Creative Director, Indigo Rose Software

Similar Threads

  1. Media Player 9.0 Issues in AMS40
    By Brett in forum AutoPlay Media Studio 4.0
    Replies: 0
    Last Post: 01-23-2003, 10:26 AM
  2. HOWTO: Repackage an Existing Installer
    By Support in forum Setup Factory 6.0 Knowledge Base
    Replies: 0
    Last Post: 10-22-2002, 01:25 PM
  3. Replies: 7
    Last Post: 02-20-2002, 08:45 AM
  4. Edit existing BDE alias
    By jdarnold in forum Setup Factory 5.0
    Replies: 0
    Last Post: 08-28-2001, 10:55 AM
  5. Replies: 0
    Last Post: 08-17-2000, 02:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts