ObjFW  Check-in [582e8986cc]

Overview
Comment:ofarc: Set mtime of files extracted from GZIP
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | set-mtime
Files: files | file ages | folders
SHA3-256: 582e8986ccea06a3f92a9e5718cfd34e150ddc4df41b350ea80a1e5db87e8615
User & Date: js on 2020-06-02 21:32:36
Other Links: branch diff | manifest | tags
Context
2020-06-02
21:35
Merge support for setting mtime (and atime) check-in: b57531df38 user: js tags: trunk
21:32
ofarc: Set mtime of files extracted from GZIP Closed-Leaf check-in: 582e8986cc user: js tags: set-mtime
21:21
OFGZIPStream: Add properties for OS and mtime check-in: da5f126be3 user: js tags: set-mtime
Changes

Modified utils/ofarc/GZIPArchive.m from [6980ee8c7c] to [1991cfed6e].

39
40
41
42
43
44
45
















46
47
48
49
50
51
52
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68







+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+







	    dictionaryWithObject: [attributes objectForKey: key]
			  forKey: key];

	[fileManager setAttributes: destinationAttributes
		      ofItemAtPath: destination];
#endif
}

static void
setModificationDate(OFString *path, OFGZIPStream *stream)
{
	OFDate *modificationDate = stream.modificationDate;
	of_file_attributes_t attributes;

	if (modificationDate == nil)
		return;

	attributes = [OFDictionary
	    dictionaryWithObject: modificationDate
			  forKey: of_file_attribute_key_modification_date];
	[[OFFileManager defaultManager] setAttributes: attributes
					 ofItemAtPath: path];
}

@implementation GZIPArchive
+ (void)initialize
{
	if (self == [GZIPArchive class])
		app = (OFArc *)[OFApplication sharedApplication].delegate;
}
127
128
129
130
131
132
133



134
135
136
137
138
139
140
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159







+
+
+








		if (length < 0) {
			app->_exitStatus = 1;
			return;
		}
	}

	[output close];
	setModificationDate(fileName, _stream);

	if (app->_outputLevel >= 0) {
		[of_stdout writeString: @"\r"];
		[of_stdout writeLine: OF_LOCALIZED(@"extracting_file_done",
		    @"Extracting %[file]... done",
		    @"file", fileName)];
	}
}