intvsteve / VINTage

Various Intellivision-related projects, including the LTO Flash! User Interface application.
GNU General Public License v2.0
3 stars 1 forks source link

Compound archive support #322

Closed intvsteve closed 5 years ago

intvsteve commented 5 years ago

This is actually a little more significant than the title may indicate. This initially was just supposed to be "make things work with *.tar.gz files. Exploring that quickly revealed that doing the work of essentially arbitrary content listing was not terribly different, so there you go.

The crux of this change is to add some extension methods to make listing the contents of archives simple and keep icky details in the helper methods. These extension methods work when listing contents of nested archives as well.

So, if you have foo.zip that contains bar.tar.gz that has a subdirectory containing baz.tar which in turn contains gnarly.zip in a subdirectory, you can start from foo.zip and list contents within the deeply nested zip archive.

Recursive listing of contents is supported as well, and 'containers' (directories and nested archives) may be eliminated from the returned results. Thus, you can easily recursively list the contents of (somewhat) arbitrary 'archive-like' files that only contain files, for example.

Tests cover the new methods, and test assets are included.

If / when other (compressed) (archive) formats are added, updating the extension methods may (or may not) be necessary.