Issues With Creating Featherspec Archives

Peter Lobsinger plobsing at gmail.com
Tue Oct 25 01:56:41 UTC 2011


On Mon, Oct 24, 2011 at 2:51 PM, Kevin Polulak <kpolulak at gmail.com> wrote:
> The problem I'm having is with recursively adding directories to an archive.
> The libzip library provides a function called zip_add_dir() that is supposed
> to do this. Unfortunately, it has no relation to the user's fileystem
> outside the archive. When you add a directory "foo", you are just creating
> an entry within the archive for a directory; you are not actually copying
> the "foo" directory from the user's filesystem. This means I have to iterate
> over the directory tree to add files. I even contacted the libzip mailing
> list and that is my only option apparently.
>
> I turned to Rosella for this and experimented with
> Rosella::FileSystem::Directory.walk(). However, it only walks through files
> and does not include directories in the resulting array so I can't do
> something like `if (is directory) { zip_add_dir() } else { zip_add() }`.
>
> Does anybody have an idea how I could fix this problem? Suggestions?

I am not experienced with libzip, but the docs do not explicitly say
you need to create directories before you put files in them. A simple
test program (attached) confirms that you don't need to do so. The one
shortcomming of this approach is that you skip empty directories, but
for some uses (including perhaps this one?), this is acceptable.

> --
> - Kevin Polulak (soh_cah_toa)
>
>
> _______________________________________________
> http://lists.parrot.org/mailman/listinfo/parrot-dev
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.c
Type: text/x-csrc
Size: 624 bytes
Desc: not available
URL: <http://lists.parrot.org/pipermail/parrot-dev/attachments/20111024/770d64bd/attachment.c>


More information about the parrot-dev mailing list