Overview
Comment: | ofzip: Support for writing files
Not supported for any file formats, yet. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
41949ecc658dcd3fdac086ef2b5a0caf |
User & Date: | js on 2017-08-05 17:48:55 |
Other Links: | manifest | tags |
Context
2017-08-05
| ||
18:00 | OFZIPArchive: Don't require an OFSeekableStream check-in: c404c33cf1 user: js tags: trunk | |
17:48 | ofzip: Support for writing files check-in: 41949ecc65 user: js tags: trunk | |
17:24 | OFGZIPStream: Prepare for adding write support check-in: ccf8ecbb83 user: js tags: trunk | |
Changes
Modified utils/ofzip/Archive.h from [9f8454bed8] to [c9b737aa7a].
︙ | |||
15 16 17 18 19 20 21 | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | - - + + + + - + + + | */ #import "OFObject.h" #import "OFFile.h" #import "OFArray.h" @protocol Archive <OFObject> |
Modified utils/ofzip/GZIPArchive.m from [85573597fb] to [39d718e85f].
︙ | |||
42 43 44 45 46 47 48 49 | 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 69 | + - + + + - + | + (void)initialize { if (self == [GZIPArchive class]) app = (OFZIP *)[[OFApplication sharedApplication] delegate]; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode { |
︙ |
Modified utils/ofzip/OFZIP.h from [b2525a3db1] to [afc71f5901].
︙ | |||
32 33 34 35 36 37 38 | 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | - + + | @public int8_t _outputLevel; OFString *_archivePath; int _exitStatus; } - (id <Archive>)openArchiveWithPath: (OFString *)path |
Modified utils/ofzip/OFZIP.m from [772087febb] to [8ac0b34839].
︙ | |||
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 29 30 31 32 33 34 35 36 37 38 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 | + + - + + + | #import "OFZIP.h" #import "GZIPArchive.h" #import "TarArchive.h" #import "ZIPArchive.h" #import "OFCreateDirectoryFailedException.h" #import "OFInvalidArgumentException.h" #import "OFInvalidFormatException.h" #import "OFNotImplementedException.h" #import "OFOpenItemFailedException.h" #import "OFReadFailedException.h" #import "OFSeekFailedException.h" #import "OFWriteFailedException.h" #define BUFFER_SIZE 4096 OF_APPLICATION_DELEGATE(OFZIP) static void help(OFStream *stream, bool full, int status) { [stream writeLine: OF_LOCALIZED(@"usage", |
︙ | |||
89 90 91 92 93 94 95 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | - + - + + + + + + + - + - - + + + - + + + + + + + + + + + + + + + + + | @"longopt1", longOption1, @"shortopt2", shortOption2Str, @"longopt2", longOption2)]; [OFApplication terminateWithStatus: 1]; } static void |
︙ | |||
187 188 189 190 191 192 193 | 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 | - - + + + + - - - + + + + + + | case 'q': if (_outputLevel > 0) mutuallyExclusiveError( 'q', @"quiet", 'v', @"verbose"); _outputLevel--; break; |
︙ | |||
233 234 235 236 237 238 239 | 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | - + + | [OFApplication terminateWithStatus: 1]; } } remainingArguments = [optionsParser remainingArguments]; archive = [self openArchiveWithPath: [remainingArguments firstObject] |
︙ | |||
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 | 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 | + + + + + + + + + + + + + + + + + + + - + | } [OFApplication terminateWithStatus: _exitStatus]; } - (id <Archive>)openArchiveWithPath: (OFString *)path type: (OFString *)type mode: (char)mode { OFString *modeString, *fileModeString; OFFile *file = nil; id <Archive> archive = nil; [_archivePath release]; _archivePath = [path copy]; if (path == nil) return nil; switch (mode) { case 'a': modeString = @"a"; fileModeString = @"r+"; break; case 'c': modeString = fileModeString = @"w"; break; case 'l': case 'p': case 'x': modeString = fileModeString = @"r"; break; default: @throw [OFInvalidArgumentException exception]; } @try { file = [OFFile fileWithPath: path |
︙ | |||
340 341 342 343 344 345 346 | 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 | - + + - - - + + + + + + + - - - - + + + + + + + + + + | type = @"tar"; else type = @"zip"; } @try { if ([type isEqual: @"gz"]) |
︙ | |||
381 382 383 384 385 386 387 388 389 390 391 392 393 394 | 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 | + + + + | } @catch (OFInvalidFormatException *e) { [of_stderr writeLine: OF_LOCALIZED( @"file_is_not_a_valid_archive", @"File %[file] is not a valid archive!", @"file", path)]; [OFApplication terminateWithStatus: 1]; } if ((mode == 'a' || mode == 'c') && ![archive respondsToSelector: @selector(addFiles:)]) writingNotSupported(type); return archive; } - (bool)shouldExtractFile: (OFString *)fileName outFileName: (OFString *)outFileName { |
︙ |
Modified utils/ofzip/TarArchive.m from [49a8dc5d2b] to [50de2565fd].
︙ | |||
44 45 46 47 48 49 50 51 | 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 69 70 71 | + - + + + - + | + (void)initialize { if (self == [TarArchive class]) app = (OFZIP *)[[OFApplication sharedApplication] delegate]; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode { |
︙ |
Modified utils/ofzip/ZIPArchive.m from [01768df2ad] to [4d9fbe54f7].
︙ | |||
53 54 55 56 57 58 59 60 | 53 54 55 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 | + - + + + - + - - + | + (void)initialize { if (self == [ZIPArchive class]) app = (OFZIP *)[[OFApplication sharedApplication] delegate]; } + (instancetype)archiveWithStream: (OF_KINDOF(OFStream *))stream mode: (OFString *)mode { |
︙ |
Modified utils/ofzip/lang/de.json from [eaae508b7c] to [e0aac008e1].
1 2 | 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 34 35 36 37 38 39 40 41 42 43 | - + + + - + - - - + + + + + + + + | { "usage": [ |
︙ |