ObjFW  Diff

Differences From Artifact [3d1c32bca2]:

To Artifact [45c0a2620e]:


22
23
24
25
26
27
28
29

30
31
32
33
34
35
36
37
#import "OFArray.h"
#import "OFFile.h"
#import "OFFileManager.h"
#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"
#import "OFWriteFailedException.h"








|
>
|







22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#import "OFArray.h"
#import "OFFile.h"
#import "OFFileManager.h"
#import "OFOptionsParser.h"
#import "OFStdIOStream.h"

#import "OFZIP.h"
#import "GZIPArchive.h"
#import "TarArchive.h"
#import "ZIPArchive.h"

#import "OFCreateDirectoryFailedException.h"
#import "OFInvalidFormatException.h"
#import "OFOpenItemFailedException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

238
239
240
241
242
243
244





245
246


247
248
249
250
251
252
253
254
255
	} @catch (OFOpenItemFailedException *e) {
		[of_stderr writeFormat: @"Failed to open file %@: %s\n",
					[e path], strerror([e errNo])];
		[OFApplication terminateWithStatus: 1];
	}

	@try {





		if ([path hasSuffix: @".gz"] || [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) {
		[of_stderr writeFormat: @"File %@ is not a valid archive!\n",
					path];







>
>
>
>
>
|
|
>
>

|







239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
	} @catch (OFOpenItemFailedException *e) {
		[of_stderr writeFormat: @"Failed to open file %@: %s\n",
					[e path], strerror([e errNo])];
		[OFApplication terminateWithStatus: 1];
	}

	@try {
		/* This one has to be first for obvious reasons */
		if ([path hasSuffix: @".tar.gz"] || [path hasSuffix: @".tgz"] ||
		    [path hasSuffix: @".TAR.GZ"] || [path hasSuffix: @".TGZ"])
			archive = [TarArchive archiveWithStream:
			    [OFGZIPStream streamWithStream: file]];
		else if ([path hasSuffix: @".gz"] || [path hasSuffix: @".GZ"])
			archive = [GZIPArchive archiveWithStream: file];
		else if ([path hasSuffix: @".tar"] || [path hasSuffix: @".TAR"])
			archive = [TarArchive archiveWithStream: file];
		else
			archive = [ZIPArchive archiveWithStream: file];
	} @catch (OFReadFailedException *e) {
		[of_stderr writeFormat: @"Failed to read file %@: %s\n",
					path, strerror([e errNo])];
		[OFApplication terminateWithStatus: 1];
	} @catch (OFInvalidFormatException *e) {
		[of_stderr writeFormat: @"File %@ is not a valid archive!\n",
					path];