@@ -30,10 +30,11 @@ #import "OFArc.h" #import "GZIPArchive.h" #import "LHAArchive.h" #import "TarArchive.h" #import "ZIPArchive.h" +#import "ZooArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" @@ -59,22 +60,22 @@ @"Options:\n" @" -a --append Append to archive\n" @" -c --create Create archive\n" @" -C --directory= Extract into the specified " @"directory\n" - @" -E --encoding= The encoding used by the archive " - "(only tar and lha files)\n" + @" -E --encoding= The encoding used by the archive\n" + @" (only tar, lha and zoo files)\n" @" -f --force Force / overwrite files\n" @" -h --help Show this help\n" @" -l --list List all files in the archive\n" @" -n --no-clobber Never overwrite files\n" @" -p --print Print one or more files from the " @"archive\n" @" -q --quiet Quiet mode (no output, except " @"errors)\n" @" -t --type= Archive type (gz, lha, tar, tgz, " - @"zip)\n" + @"zip, zoo)\n" @" -v --verbose Verbose output for file list\n" @" -x --extract Extract files")]; } [OFApplication terminateWithStatus: status]; @@ -554,22 +555,27 @@ [OFApplication terminateWithStatus: 1]; } } if (type == nil || [type isEqual: @"auto"]) { + OFString *lowercasePath = path.lowercaseString; + /* This one has to be first for obvious reasons */ - if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] || - [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"]) + if ([lowercasePath hasSuffix: @".tar.gz"] || + [lowercasePath hasSuffix: @".tgz"]) type = @"tgz"; - else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"]) + else if ([lowercasePath hasSuffix: @".gz"]) type = @"gz"; - else if ([path hasSuffix: @".lha"] || - [path hasSuffix: @".lzh"] || [path hasSuffix: @".lzs"] || - [path hasSuffix: @".pma"]) + else if ([lowercasePath hasSuffix: @".lha"] || + [lowercasePath hasSuffix: @".lzh"] || + [lowercasePath hasSuffix: @".lzs"] || + [lowercasePath hasSuffix: @".pma"]) type = @"lha"; - else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"]) + else if ([lowercasePath hasSuffix: @".tar"]) type = @"tar"; + else if ([lowercasePath hasSuffix: @".zoo"]) + type = @"zoo"; else type = @"zip"; } @try { @@ -597,10 +603,15 @@ mode: modeString encoding: encoding]; } else if ([type isEqual: @"zip"]) archive = [ZIPArchive archiveWithPath: path stream: file + mode: modeString + encoding: encoding]; + else if ([type isEqual: @"zoo"]) + archive = [ZooArchive archiveWithPath: path + stream: file mode: modeString encoding: encoding]; else { [OFStdErr writeLine: OF_LOCALIZED( @"unknown_archive_type",