@@ -29,10 +29,11 @@ #import "OFStdIOStream.h" #import "OFURL.h" #import "OFZIP.h" #import "GZIPArchive.h" +#import "LHAArchive.h" #import "TarArchive.h" #import "ZIPArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidArgumentException.h" @@ -71,11 +72,12 @@ @" -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, tar, tgz, zip)\n" + @" -t --type Archive type (gz, lha, tar, tgz, " + @"zip)\n" @" -v --verbose Verbose output for file list\n" @" -x --extract Extract files")]; } [OFApplication terminateWithStatus: status]; @@ -440,10 +442,12 @@ if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] || [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"]) type = @"tgz"; else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"]) type = @"gz"; + else if ([path hasSuffix: @".lha"] || [path hasSuffix: @".lzh"]) + type = @"lha"; else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"]) type = @"tar"; else type = @"zip"; } @@ -451,10 +455,14 @@ @try { if ([type isEqual: @"gz"]) archive = [GZIPArchive archiveWithStream: file mode: modeString encoding: encoding]; + else if ([type isEqual: @"lha"]) + archive = [LHAArchive archiveWithStream: file + mode: modeString + encoding: encoding]; else if ([type isEqual: @"tar"]) archive = [TarArchive archiveWithStream: file mode: modeString encoding: encoding]; else if ([type isEqual: @"tgz"]) {