ObjFW  Check-in [f7dd7edde4]

Overview
Comment:ofarc: Ignore EISDIR for setting modification date
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f7dd7edde483f8489e7724a13af3258b90c0d4a98355d75a6e401c2e29f01d55
User & Date: js on 2022-12-24 22:15:15
Other Links: manifest | tags
Context
2022-12-25
11:39
configure: Fix quoting issue check-in: 23872fb11d user: js tags: trunk
2022-12-24
22:15
ofarc: Ignore EISDIR for setting modification date check-in: f7dd7edde4 user: js tags: trunk
22:04
OFFileIRIHandler: Translate EACCES on Windows check-in: ede0671032 user: js tags: trunk
Changes

Modified utils/ofarc/LHAArchive.m from [7f7a619844] to [01fbfcd559].

10
11
12
13
14
15
16


17
18
19
20
21
22
23
24
25
26
27
28


29
30
31
32
33
34
35
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39







+
+












+
+







 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <errno.h>

#import "OFApplication.h"
#import "OFDate.h"
#import "OFFileManager.h"
#import "OFLocale.h"
#import "OFNumber.h"
#import "OFSet.h"
#import "OFStdIOStream.h"
#import "OFString.h"

#import "LHAArchive.h"
#import "OFArc.h"

#import "OFSetItemAttributesFailedException.h"

static OFArc *app;

static OFString *
indent(OFString *string)
{
	return [string stringByReplacingOccurrencesOfString: @"\n"
59
60
61
62
63
64
65

66
67






68
69
70
71
72
73
74
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79
80
81
82
83







+
-
-
+
+
+
+
+
+








static void
setModificationDate(OFString *path, OFLHAArchiveEntry *entry)
{
	OFFileAttributes attributes = [OFDictionary
	    dictionaryWithObject: entry.modificationDate
			  forKey: OFFileModificationDate];
	@try {
	[[OFFileManager defaultManager] setAttributes: attributes
					 ofItemAtPath: path];
		[[OFFileManager defaultManager] setAttributes: attributes
						 ofItemAtPath: path];
	} @catch (OFSetItemAttributesFailedException *e) {
		if (e.errNo != EISDIR)
			@throw e;
	}
}

@implementation LHAArchive
+ (void)initialize
{
	if (self == [LHAArchive class])
		app = (OFArc *)[OFApplication sharedApplication].delegate;

Modified utils/ofarc/TarArchive.m from [1feea72626] to [c347faaf39].

10
11
12
13
14
15
16


17
18
19
20
21
22
23
24
25
26
27
28


29
30
31
32
33
34
35
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39







+
+












+
+







 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <errno.h>

#import "OFApplication.h"
#import "OFDate.h"
#import "OFFileManager.h"
#import "OFLocale.h"
#import "OFNumber.h"
#import "OFSet.h"
#import "OFStdIOStream.h"
#import "OFString.h"

#import "TarArchive.h"
#import "OFArc.h"

#import "OFSetItemAttributesFailedException.h"

static OFArc *app;

static void
setPermissions(OFString *path, OFTarArchiveEntry *entry)
{
#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
52
53
54
55
56
57
58

59
60






61
62
63
64
65
66
67
56
57
58
59
60
61
62
63


64
65
66
67
68
69
70
71
72
73
74
75
76







+
-
-
+
+
+
+
+
+








	if (modificationDate == nil)
		return;

	attributes = [OFDictionary
	    dictionaryWithObject: modificationDate
			  forKey: OFFileModificationDate];
	@try {
	[[OFFileManager defaultManager] setAttributes: attributes
					 ofItemAtPath: path];
		[[OFFileManager defaultManager] setAttributes: attributes
						 ofItemAtPath: path];
	} @catch (OFSetItemAttributesFailedException *e) {
		if (e.errNo != EISDIR)
			@throw e;
	}
}

@implementation TarArchive
+ (void)initialize
{
	if (self == [TarArchive class])
		app = (OFArc *)[OFApplication sharedApplication].delegate;

Modified utils/ofarc/ZIPArchive.m from [cefb3af267] to [ef2bc5e047].

29
30
31
32
33
34
35

36
37
38
39
40
41
42
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43







+








#import "ZIPArchive.h"
#import "OFArc.h"

#import "OFInvalidFormatException.h"
#import "OFOpenItemFailedException.h"
#import "OFOutOfRangeException.h"
#import "OFSetItemAttributesFailedException.h"

static OFArc *app;

static void
setPermissions(OFString *path, OFZIPArchiveEntry *entry)
{
#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
62
63
64
65
66
67
68

69
70






71
72
73
74
75
76
77
63
64
65
66
67
68
69
70


71
72
73
74
75
76
77
78
79
80
81
82
83







+
-
-
+
+
+
+
+
+








	if (modificationDate == nil)
		return;

	attributes = [OFDictionary
	    dictionaryWithObject: modificationDate
			  forKey: OFFileModificationDate];
	@try {
	[[OFFileManager defaultManager] setAttributes: attributes
					 ofItemAtPath: path];
		[[OFFileManager defaultManager] setAttributes: attributes
						 ofItemAtPath: path];
	} @catch (OFSetItemAttributesFailedException *e) {
		if (e.errNo != EISDIR)
			@throw e;
	}
}

@implementation ZIPArchive
+ (void)initialize
{
	if (self == [ZIPArchive class])
		app = (OFArc *)[OFApplication sharedApplication].delegate;