@@ -25,10 +25,11 @@ #import "OFOptionsParser.h" #import "OFStdIOStream.h" #import "OFZIP.h" #import "ZIPArchive.h" +#import "GZIPArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidFormatException.h" #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" @@ -197,10 +198,13 @@ - (id )openArchiveWithPath: (OFString*)path { OFFile *file; id archive; + [_archivePath release]; + _archivePath = [path copy]; + @try { file = [OFFile fileWithPath: path mode: @"rb"]; } @catch (OFOpenItemFailedException *e) { [of_stderr writeFormat: @"Failed to open file %@: %s\n", @@ -207,11 +211,14 @@ [e path], strerror([e errNo])]; [OFApplication terminateWithStatus: 1]; } @try { - archive = [ZIPArchive archiveWithFile: file]; + if ([path hasSuffix: @".gz"]) + archive = [GZIPArchive archiveWithFile: file]; + else + archive = [ZIPArchive archiveWithFile: file]; } @catch (OFReadFailedException *e) { [of_stderr writeFormat: @"Failed to read file %@: %s\n", path, strerror([e errNo])]; [OFApplication terminateWithStatus: 1]; } @catch (OFInvalidFormatException *e) {