Skip to content
  • Rob Swindell's avatar
    Fixup extract_diz() - fallback to external archivers · e2d3cd89
    Rob Swindell authored
    The fallback to external extractors/archivers didn't really work unless a
    libarchive function (called from extract_files_from_archive) actually failed
    and the return value was < 0. A return value of 0 would mean the external
    file extractor would never be used.
    
    This was discovered when trying to import DIZ from old ZIP files (from 1992)
    that used "Implode" compression method for the FILE_ID.DIZ, which is a
    compression method *not* supported by libarchive. This is a reason why sysops
    might want to leave Info-zip's 'unzip' as a configured Extractable File Type
    handler (in SCFG) for 'zip' files.
    
    Don't call the external archiver 3 times for the 3 DIZ filenames supported.
    Just call the external archiver once, and pass all 3 filesnames. This also
    means that the call to system() can return non-zero (e.g. Info-zip 'unzip'
    will return 2 if any of the files aren't present in the archive, even if
    one is) - so ignore this return value from system(). This speeds up bulk
    import (e.g. using addfiles.js).
    
    Unfortunately, I couldn't really find a nice cross-platform way to suppress
    the unzip "caution: filename not matched" message sent to stderr. That's
    a bummer and a little annoying.
    
    Ignore 0-length DIZ files.
    e2d3cd89