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.)

Reply via email to