Andrei Alexandrescu wrote:
Heh, incidentally I just needed a tar reader a few days ago, so I wrote
an embryo of a base class etc. I'll add it soon.
The basic interface is:
(a) open the archive
(b) get an input range for it. The range iterates over archive entries.
(c) You can look at archive info, and if you want to extract you can get
a .byChunk() range to extract it. That's also an input range.
For now I'm only concerned with reading... writing needs to be added.
That's great, but I only suggest that this not be added to Phobos until a
generic archive interface is also added. That way, we can constantly add support
for new archive formats without requiring users to change their code.
Some suggestions for that:
1. The archive type should be represented by a string literal, not an enum. This
way, users can add other archive types without having to touch the Phobos source
code.
2. The reader should auto-detect the archive type based on the file contents,
not the file name, and then call the appropriate factory method.