Differences From Artifact [e1794bea79]:
- File
utils/ofarc/LHAArchive.m
— part of check-in
[f2109cf1c3]
at
2023-07-22 14:47:51
on branch trunk
— utils/ofarc: Pass the path of the archive
This is in preparation for supporting split archives. (user: js, size: 14256) [annotate] [blame] [check-ins using] [more...]
To Artifact [f7ef0447c1]:
- File utils/ofarc/LHAArchive.m — part of check-in [f007fe7b02] at 2024-03-02 11:41:32 on branch trunk — ofarc: Delay setting modified date of directories (user: js, size: 14700) [annotate] [blame] [check-ins using] [more...]
1 | /* | | > > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | /* * Copyright (c) 2008-2024 Jonathan Schleifer <js@nil.im> * * All rights reserved. * * This file is part of ObjFW. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE.QPL included in * the packaging of this file. * * 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 "OFArray.h" #import "OFDate.h" #import "OFFileManager.h" #import "OFLocale.h" #import "OFNumber.h" #import "OFPair.h" #import "OFSet.h" #import "OFStdIOStream.h" #import "OFString.h" #import "LHAArchive.h" #import "OFArc.h" |
︙ | ︙ | |||
259 260 261 262 263 264 265 266 267 268 269 270 271 272 | } } - (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files { OFFileManager *fileManager = [OFFileManager defaultManager]; bool all = (files.count == 0); OFMutableSet OF_GENERIC(OFString *) *missing = [OFMutableSet setWithArray: files]; OFLHAArchiveEntry *entry; while ((entry = [_archive nextEntry]) != nil) { void *pool = objc_autoreleasePoolPush(); OFString *fileName = entry.fileName; | > | 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | } } - (void)extractFiles: (OFArray OF_GENERIC(OFString *) *)files { OFFileManager *fileManager = [OFFileManager defaultManager]; bool all = (files.count == 0); OFMutableArray *delayedModificationDates = [OFMutableArray array]; OFMutableSet OF_GENERIC(OFString *) *missing = [OFMutableSet setWithArray: files]; OFLHAArchiveEntry *entry; while ((entry = [_archive nextEntry]) != nil) { void *pool = objc_autoreleasePoolPush(); OFString *fileName = entry.fileName; |
︙ | ︙ | |||
297 298 299 300 301 302 303 | @"Extracting %[file]...", @"file", fileName)]; if ([fileName hasSuffix: @"/"]) { [fileManager createDirectoryAtPath: outFileName createParents: true]; setPermissions(outFileName, entry); | > > > > > | > > | 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | @"Extracting %[file]...", @"file", fileName)]; if ([fileName hasSuffix: @"/"]) { [fileManager createDirectoryAtPath: outFileName createParents: true]; setPermissions(outFileName, entry); /* * As creating a new file in a directory changes its * modification date, we can only set it once all files * have been created. */ [delayedModificationDates addObject: [OFPair pairWithFirstObject: outFileName secondObject: entry]]; if (app->_outputLevel >= 0) { [OFStdOut writeString: @"\r"]; [OFStdOut writeLine: OF_LOCALIZED( @"extracting_file_done", @"Extracting %[file]... done", @"file", fileName)]; |
︙ | ︙ | |||
367 368 369 370 371 372 373 374 375 376 377 378 379 380 | @"file", fileName)]; } outer_loop_end: objc_autoreleasePoolPop(pool); } if (missing.count > 0) { for (OFString *file in missing) [OFStdErr writeLine: OF_LOCALIZED( @"file_not_in_archive", @"File %[file] is not in the archive!", @"file", file)]; | > > > | 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | @"file", fileName)]; } outer_loop_end: objc_autoreleasePoolPop(pool); } for (OFPair *pair in delayedModificationDates) setModificationDate(pair.firstObject, pair.secondObject); if (missing.count > 0) { for (OFString *file in missing) [OFStdErr writeLine: OF_LOCALIZED( @"file_not_in_archive", @"File %[file] is not in the archive!", @"file", file)]; |
︙ | ︙ |