ZipEngine & directories

BlitzMax Forums/BlitzMax Programming/ZipEngine & directories

plash(Posted 2007) [#1]
Is there not a way to save a file to a .zip with folder structure, using zipengine?

I know how to read a file from a zip with a file structure (zrObj.ExtractFileToDisk("cfg/text/text.txt" ....), but if I were to call ZIPWRITEOBJECT.AddFile("testing\files\text.txt"), it would be looking for a file in CurrentDirectory + "testing\files\text.txt", which is ovbiously not what I would like to do.


plash(Posted 2007) [#2]
Looks like the whole zip writing thing doesn't even work, saving a simple text file to an empty existing .zip, then trying to load that same .zip in winrar shows an unexpected end of archive from diagnostics..

Heres an example.. (create data.txt and type in some gibberish)
Local zwObject:ZipWriter = New ZipWriter

'Also tested with data.zip existing and not existing
If zwObject.OpenZip("data.zip", True) Then ' Even changing the append param to True doesn't work
	zwObject.AddFile("data.txt")
Else
	Throw "data.zip was not found or did not load correctly."
End If



Grisu(Posted 2007) [#3]
Are you using Gman's Zipmodule 2.0?

Have you tried using "/" instead of "\" for the path structure?


plash(Posted 2007) [#4]
Yep, version 2.06..
And yes I have tried using both slashes, same results for each test.


Grisu(Posted 2007) [#5]
Dig out a complete! example code and ask Gman for help.

You could do so via E-Mail or forums:
http://www.gprogs.com/forum/viewforum.php?id=8


gman(Posted 2007) [#6]
greetings :) i know you mentioned you tried it this way, but i can only replicate if the zip doesnt exist and True is passed into OpenZip(). in order for the zipengine to automatically create a file OpenZip() needs False as the append parameter. i did try opening an existing zip created with IZArc and it successfully ran, but only after it already had at least one file in it. i would assume it needs the proper zip headers written to the file in order to function in append mode.

have you tried running the available sample? in the course of the sample it does exactly what you are trying. if you havent done it already i think this is the first step.

also, have you tried rebuilding the mod?