ObjFW  Diff

Differences From Artifact [fb0bc51e00]:

To Artifact [5f83697ea8]:


56
57
58
59
60
61
62
63
64

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

79
80
81
82
83
84
85
56
57
58
59
60
61
62


63














64
65
66
67
68
69
70
71







-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+







					 ofItemAtPath: path];
#endif
}

static void
setModificationDate(OFString *path, OFLHAArchiveEntry *entry)
{
	OFDate *modificationDate = entry.modificationDate;
	OFFileAttributes attributes;
	OFFileAttributes attributes = [OFDictionary

	if (modificationDate == nil) {
		/*
		 * Fall back to the original date if we have no modification
		 * date, as the modification date is a UNIX extension.
		 */
		modificationDate = entry.date;

		if (modificationDate == nil)
			return;
	}

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

@implementation LHAArchive
+ (void)initialize
130
131
132
133
134
135
136
137

138
139
140
141
142
143
144
116
117
118
119
120
121
122

123
124
125
126
127
128
129
130







-
+








	while ((entry = [_archive nextEntry]) != nil) {
		void *pool = objc_autoreleasePoolPush();

		[OFStdOut writeLine: entry.fileName];

		if (app->_outputLevel >= 1) {
			OFString *date = [entry.date
			OFString *modificationDate = [entry.modificationDate
			    localDateStringWithFormat: @"%Y-%m-%d %H:%M:%S"];
			OFString *compressedSize = [OFString stringWithFormat:
			    @"%" PRIu32, entry.compressedSize];
			OFString *uncompressedSize = [OFString stringWithFormat:
			    @"%" PRIu32, entry.uncompressedSize];
			OFString *CRC16 = [OFString stringWithFormat:
			    @"%04" PRIX16, entry.CRC16];
171
172
173
174
175
176
177
178
179
180




181
182
183
184
185
186
187
157
158
159
160
161
162
163



164
165
166
167
168
169
170
171
172
173
174







-
-
-
+
+
+
+







			    @"Compression method: %[method]",
			    @"method", entry.compressionMethod)];
			[OFStdOut writeString: @"\t"];
			[OFStdOut writeLine: OF_LOCALIZED(@"list_crc16",
			    @"CRC16: %[crc16]",
			    @"crc16", CRC16)];
			[OFStdOut writeString: @"\t"];
			[OFStdOut writeLine: OF_LOCALIZED(@"list_date",
			    @"Date: %[date]",
			    @"date", date)];
			[OFStdOut writeLine: OF_LOCALIZED(
			    @"list_modification_date",
			    @"Modification date: %[date]",
			    @"date", modificationDate)];

			if (entry.mode != nil) {
				OFString *modeString = [OFString
				    stringWithFormat:
				    @"%ho", entry.mode.unsignedShortValue];

				[OFStdOut writeString: @"\t"];
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
222
223
224
225
226
227
228











229
230
231
232
233
234
235







-
-
-
-
-
-
-
-
-
-
-







					[OFStdOut writeString: @"\t"];
					[OFStdOut writeLine: OF_LOCALIZED(
					    @"list_osid",
					    @"Operating system identifier: "
					    "%[osid]",
					    @"osid", OSID)];
				}

				if (entry.modificationDate != nil) {
					OFString *modificationDate =
					    entry.modificationDate.description;

					[OFStdOut writeString: @"\t"];
					[OFStdOut writeLine: OF_LOCALIZED(
					    @"list_modification_date",
					    @"Modification date: %[date]",
					    @"date", modificationDate)];
				}
			}

			if (app->_outputLevel >= 3) {
				OFString *extensions =
				    indent(entry.extensions.description);

				[OFStdOut writeString: @"\t"];
467
468
469
470
471
472
473
474

475
476
477
478
479
480
481
443
444
445
446
447
448
449

450
451
452
453
454
455
456
457







-
+







		type = attributes.fileType;
		entry = [OFMutableLHAArchiveEntry entryWithFileName: fileName];

#ifdef OF_FILE_MANAGER_SUPPORTS_PERMISSIONS
		entry.mode = [OFNumber numberWithUnsignedLong:
		    attributes.filePOSIXPermissions];
#endif
		entry.date = attributes.fileModificationDate;
		entry.modificationDate = attributes.fileModificationDate;

#ifdef OF_FILE_MANAGER_SUPPORTS_OWNER
		entry.UID = [OFNumber numberWithUnsignedLong:
		    attributes.fileOwnerAccountID];
		entry.GID = [OFNumber numberWithUnsignedLong:
		    attributes.fileGroupOwnerAccountID];
		entry.owner = attributes.fileOwnerAccountName;