I'm using FZip in an AIR application, the application loads the zip
from a location on our server, unpacks the zip and move the files to
their local folder. Everything runs smooth until I cut off my internet
connection while the zip is downloading.
When I restart the application it looks like FZip is first checking
the temp folder for the cached zip and if found, it uses that one to
unzip, even if the zip was not completed the last time.

Does anyone know of a way to prevent that?

I use the default load method of the FZip library, this is a part of
the code I use.

var moduleLink:String = [EMAIL PROTECTED];

var zip:FZip = new FZip();

zip.addEventListener(Event.COMPLETE, onComplete);

zip.load(new URLRequest(moduleLink));

private function onComplete(evt:Event):void 
{
        var moduleDir:File =
File.applicationStorageDirectory.resolvePath("modules");
        
        var outStream:FileStream;
        
        for(var i:int; i<evt.target.getFileCount();i++)
        {
                var zipFile:FZipFile = evt.target.getFileAt(i);
                
                if(zipFile.sizeUncompressed == 0 &&
zipFile.filename.toString().substr(-1) == "/")
                {
                        var rootDir:File =
File.applicationStorageDirectory.resolvePath("modules/"+zipFile.filename.toString());
                }
                else
                {
                        var tempFile:File = 
moduleDir.resolvePath(zipFile.filename);
                        
                        outStream = new FileStream();
                        
                        outStream.open(tempFile, FileMode.WRITE);
                        
                        outStream.writeBytes(zipFile.content, 0, 
zipFile.sizeUncompressed);
                        
                        outStream.close();
                }
        }
        evt.target.close();
}

Thanks in advance

Reply via email to