Is there a std.zip.ZipArchive isDir or isFile method?
mark
mark at qtrac.eu
Mon Feb 3 13:26:38 UTC 2020
I'm using std.zip.ZipArchive to read zip files, e.g.:
auto zip = new ZipArchive(read(filename));
// ...
foreach (name, member; zip.directory) {
if (name.endsWith('/')) // skip dirs
continue;
mkdirRecurse(dirName(name));
zip.expand(member);
write(name, member.expandedData());
}
As you can see, I am detecting directories with a crude test.
I really wish there was a method for this: and if there is, could
you give me the link 'cos I can't see one in the docs?
(BTW The code above is slightly simplified: the real code won't
unzip if there's an absolute path or .. present and also ensures
that all members are unzipped into a subdir even if the zip has
top-level names.)
More information about the Digitalmars-d-learn
mailing list