 |
Changeset 3195
- Timestamp:
- 02/16/08 01:13:06
(10 months ago)
- Author:
- DRK
- Message:
Renamed ZipArchive?,ZipFolder? to ZipFolder?,ZipSubFolder?, and updated the vfszip example to match. closes #839
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3127 |
r3195 |
|
| 1 | 1 | module vfszip; |
|---|
| 2 | 2 | |
|---|
| 3 | | import tango.io.vfs.ZipArchive; |
|---|
| | 3 | import tango.io.vfs.ZipFolder; |
|---|
| 4 | 4 | import tango.io.Stdout; |
|---|
| 5 | 5 | |
|---|
| … | … | |
| 23 | 23 | zipname = "tmp.zip"; |
|---|
| 24 | 24 | |
|---|
| 25 | | auto archive = new ZipArchive(zipname); |
|---|
| | 25 | auto archive = new ZipFolder(zipname); |
|---|
| 26 | 26 | auto info = archive.self; |
|---|
| 27 | 27 | |
|---|
| r3185 |
r3195 |
|
| 5 | 5 | license: BSD style: $(LICENSE) |
|---|
| 6 | 6 | |
|---|
| 7 | | version: Initial release: December 2007 |
|---|
| | 7 | version: The Great Namechange: February 2008 |
|---|
| | 8 | |
|---|
| | 9 | Initial release: December 2007 |
|---|
| 8 | 10 | |
|---|
| 9 | 11 | author: Daniel Keep |
|---|
| … | … | |
| 11 | 13 | *******************************************************************************/ |
|---|
| 12 | 14 | |
|---|
| 13 | | module tango.io.vfs.ZipArchive; |
|---|
| | 15 | module tango.io.vfs.ZipFolder; |
|---|
| 14 | 16 | |
|---|
| 15 | 17 | import tango.io.FileConduit : FileConduit; |
|---|
| … | … | |
| 24 | 26 | import tango.util.PathUtil : patternMatch; |
|---|
| 25 | 27 | |
|---|
| 26 | | debug( ZipArchive ) |
|---|
| | 28 | debug( ZipFolder ) |
|---|
| 27 | 29 | { |
|---|
| 28 | 30 | import tango.io.Stdout : Stderr; |
|---|
| … | … | |
| 172 | 174 | file.tempFile.output.copy(zi).close; |
|---|
| 173 | 175 | |
|---|
| 174 | | debug( ZipArchive ) |
|---|
| | 176 | debug( ZipFolder ) |
|---|
| 175 | 177 | Stderr.formatln("Entry.openOutput: duplicated" |
|---|
| 176 | 178 | " temp file {} for {}", |
|---|
| … | … | |
| 187 | 189 | file.tempFile = new TempFile; |
|---|
| 188 | 190 | |
|---|
| 189 | | debug( ZipArchive ) |
|---|
| | 191 | debug( ZipFolder ) |
|---|
| 190 | 192 | Stderr.formatln("Entry.openOutput: created" |
|---|
| 191 | 193 | " temp file {} for {}", |
|---|
| … | … | |
| 241 | 243 | break; |
|---|
| 242 | 244 | |
|---|
| 243 | | debug( ZipArchive ) |
|---|
| | 245 | debug( ZipFolder ) |
|---|
| 244 | 246 | { |
|---|
| 245 | 247 | default: |
|---|
| … | … | |
| 277 | 279 | |
|---|
| 278 | 280 | /** |
|---|
| 279 | | * ZipArchive serves as the root object for all Zip archives in the VFS. |
|---|
| | 281 | * ZipFolder serves as the root object for all Zip archives in the VFS. |
|---|
| 280 | 282 | * Presently, it can only open archives on the local filesystem. |
|---|
| 281 | 283 | */ |
|---|
| 282 | | class ZipArchive : ZipFolder |
|---|
| | 284 | class ZipFolder : ZipSubFolder |
|---|
| 283 | 285 | { |
|---|
| 284 | 286 | /** |
|---|
| … | … | |
| 291 | 293 | body |
|---|
| 292 | 294 | { |
|---|
| 293 | | debug( ZipArchive ) |
|---|
| 294 | | Stderr.formatln(`ZipArchive("{}", {})`, path, readonly); |
|---|
| | 295 | debug( ZipFolder ) |
|---|
| | 296 | Stderr.formatln(`ZipFolder("{}", {})`, path, readonly); |
|---|
| 295 | 297 | this(FilePath(path), readonly); |
|---|
| 296 | 298 | } |
|---|
| … | … | |
| 301 | 303 | body |
|---|
| 302 | 304 | { |
|---|
| 303 | | debug( ZipArchive ) |
|---|
| 304 | | Stderr.formatln(`ZipArchive("{}", {})`, path, readonly); |
|---|
| | 305 | debug( ZipFolder ) |
|---|
| | 306 | Stderr.formatln(`ZipFolder("{}", {})`, path, readonly); |
|---|
| 305 | 307 | this.resetArchive(path, readonly); |
|---|
| 306 | 308 | super(this, root); |
|---|
| … | … | |
| 316 | 318 | body |
|---|
| 317 | 319 | { |
|---|
| 318 | | debug( ZipArchive ) |
|---|
| 319 | | Stderr.formatln("ZipArchive.close({})",commit); |
|---|
| | 320 | debug( ZipFolder ) |
|---|
| | 321 | Stderr.formatln("ZipFolder.close({})",commit); |
|---|
| 320 | 322 | |
|---|
| 321 | 323 | // MUTATE |
|---|
| … | … | |
| 351 | 353 | body |
|---|
| 352 | 354 | { |
|---|
| 353 | | debug( ZipArchive ) |
|---|
| 354 | | Stderr("ZipArchive.sync()").newline; |
|---|
| | 355 | debug( ZipFolder ) |
|---|
| | 356 | Stderr("ZipFolder.sync()").newline; |
|---|
| 355 | 357 | |
|---|
| 356 | 358 | if( !modified ) |
|---|
| 357 | 359 | return this; |
|---|
| 358 | 360 | |
|---|
| 359 | | version( ZipArchive_NonMutating ) |
|---|
| 360 | | { |
|---|
| 361 | | mutate_error("ZipArchive.sync"); |
|---|
| | 361 | version( ZipFolder_NonMutating ) |
|---|
| | 362 | { |
|---|
| | 363 | mutate_error("ZipFolder.sync"); |
|---|
| 362 | 364 | assert(false); |
|---|
| 363 | 365 | } |
|---|
| … | … | |
| 380 | 382 | tempFile = new TempFile(path.path, TempFile.Permanent); |
|---|
| 381 | 383 | os = tempFile.output; |
|---|
| 382 | | debug( ZipArchive ) |
|---|
| | 384 | debug( ZipFolder ) |
|---|
| 383 | 385 | Stderr.formatln(" sync: created temp file {}", |
|---|
| 384 | 386 | tempFile.path); |
|---|
| … | … | |
| 422 | 424 | |
|---|
| 423 | 425 | // With that done, we can free all our handles, etc. |
|---|
| 424 | | debug( ZipArchive ) |
|---|
| | 426 | debug( ZipFolder ) |
|---|
| 425 | 427 | Stderr(" sync: close").newline; |
|---|
| 426 | 428 | this.close(/*commit*/ false); |
|---|
| … | … | |
| 431 | 433 | if( tempFile !is null ) |
|---|
| 432 | 434 | { |
|---|
| 433 | | debug( ZipArchive ) |
|---|
| | 435 | debug( ZipFolder ) |
|---|
| 434 | 436 | Stderr(" sync: destroying temp file").newline; |
|---|
| 435 | 437 | auto tempFilePath = tempFile.path.dup; |
|---|
| 436 | 438 | delete tempFile; |
|---|
| 437 | | debug( ZipArchive ) |
|---|
| | 439 | debug( ZipFolder ) |
|---|
| 438 | 440 | Stderr.formatln(" sync: renaming {} to {}", |
|---|
| 439 | 441 | tempFilePath, path); |
|---|
| … | … | |
| 443 | 445 | // Finally, re-open the archive so that we have all the nicely |
|---|
| 444 | 446 | // compressed files. |
|---|
| 445 | | debug( ZipArchive ) |
|---|
| | 447 | debug( ZipFolder ) |
|---|
| 446 | 448 | Stderr(" sync: reset archive").newline; |
|---|
| 447 | 449 | this.resetArchive(path, readonly); |
|---|
| 448 | 450 | |
|---|
| 449 | | debug( ZipArchive ) |
|---|
| | 451 | debug( ZipFolder ) |
|---|
| 450 | 452 | Stderr(" sync: reset folder").newline; |
|---|
| 451 | 453 | this.reset(this, root); |
|---|
| 452 | 454 | |
|---|
| 453 | | debug( ZipArchive ) |
|---|
| | 455 | debug( ZipFolder ) |
|---|
| 454 | 456 | Stderr(" sync: done").newline; |
|---|
| 455 | 457 | |
|---|
| … | … | |
| 484 | 486 | final bool closed() |
|---|
| 485 | 487 | { |
|---|
| 486 | | debug( ZipArchive ) |
|---|
| 487 | | Stderr("ZipArchive.closed()").newline; |
|---|
| | 488 | debug( ZipFolder ) |
|---|
| | 489 | Stderr("ZipFolder.closed()").newline; |
|---|
| 488 | 490 | return (root is null); |
|---|
| 489 | 491 | } |
|---|
| … | … | |
| 491 | 493 | final bool valid() |
|---|
| 492 | 494 | { |
|---|
| 493 | | debug( ZipArchive ) |
|---|
| 494 | | Stderr("ZipArchive.valid()").newline; |
|---|
| | 495 | debug( ZipFolder ) |
|---|
| | 496 | Stderr("ZipFolder.valid()").newline; |
|---|
| 495 | 497 | return !closed; |
|---|
| 496 | 498 | } |
|---|
| … | … | |
| 516 | 518 | body |
|---|
| 517 | 519 | { |
|---|
| 518 | | debug( ZipArchive ) |
|---|
| 519 | | Stderr.formatln(`ZipArchive.resetArchive("{}", {})`, path, readonly); |
|---|
| 520 | | |
|---|
| 521 | | debug( ZipArchive ) |
|---|
| | 520 | debug( ZipFolder ) |
|---|
| | 521 | Stderr.formatln(`ZipFolder.resetArchive("{}", {})`, path, readonly); |
|---|
| | 522 | |
|---|
| | 523 | debug( ZipFolder ) |
|---|
| 522 | 524 | Stderr.formatln(" .. size of Entry: {0}, {0:x} bytes", Entry.sizeof); |
|---|
| 523 | 525 | |
|---|
| … | … | |
| 624 | 626 | * This class represents a folder in an archive. In addition to supporting |
|---|
| 625 | 627 | * the sync operation, you can also use the archive member to get a reference |
|---|
| 626 | | * to the underlying ZipArchive instance. |
|---|
| | 628 | * to the underlying ZipFolder instance. |
|---|
| 627 | 629 | */ |
|---|
| 628 | | class ZipFolder : VfsFolder, VfsSync |
|---|
| | 630 | class ZipSubFolder : VfsFolder, VfsSync |
|---|
| 629 | 631 | { |
|---|
| 630 | 632 | /// |
|---|
| … | … | |
| 693 | 695 | // Locate the folder in question. We do this by "walking" the |
|---|
| 694 | 696 | // path components. If we find a component that doesn't exist, |
|---|
| 695 | | // then we create a ZipFolderEntry for the remainder. |
|---|
| | 697 | // then we create a ZipSubFolderEntry for the remainder. |
|---|
| 696 | 698 | Entry* curent = this.entry; |
|---|
| 697 | 699 | |
|---|
| … | … | |
| 719 | 721 | // If the next component doesn't exist, return a folder entry. |
|---|
| 720 | 722 | // If the tail is empty, return a folder entry as well (let |
|---|
| 721 | | // the ZipFolderEntry do the last lookup.) |
|---|
| 722 | | return new ZipFolderEntry(archive, curent, ht); |
|---|
| | 723 | // the ZipSubFolderEntry do the last lookup.) |
|---|
| | 724 | return new ZipSubFolderEntry(archive, curent, ht); |
|---|
| 723 | 725 | } |
|---|
| 724 | 726 | while( true ); |
|---|
| … | … | |
| 730 | 732 | body |
|---|
| 731 | 733 | { |
|---|
| 732 | | return new ZipFolderGroup(archive, this, false); |
|---|
| | 734 | return new ZipSubFolderGroup(archive, this, false); |
|---|
| 733 | 735 | } |
|---|
| 734 | 736 | |
|---|
| … | … | |
| 738 | 740 | body |
|---|
| 739 | 741 | { |
|---|
| 740 | | return new ZipFolderGroup(archive, this, true); |
|---|
| | 742 | return new ZipSubFolderGroup(archive, this, true); |
|---|
| 741 | 743 | } |
|---|
| 742 | 744 | |
|---|
| … | … | |
| 752 | 754 | if( childEntry.isDir ) |
|---|
| 753 | 755 | { |
|---|
| 754 | | VfsFolder childFolder = new ZipFolder(archive, childEntry); |
|---|
| | 756 | VfsFolder childFolder = new ZipSubFolder(archive, childEntry); |
|---|
| 755 | 757 | if( (result = dg(childFolder)) != 0 ) |
|---|
| 756 | 758 | break; |
|---|
| … | … | |
| 766 | 768 | body |
|---|
| 767 | 769 | { |
|---|
| 768 | | version( ZipArchive_NonMutating ) |
|---|
| | 770 | version( ZipFolder_NonMutating ) |
|---|
| 769 | 771 | { |
|---|
| 770 | 772 | mutate_error("VfsFolder.clear"); |
|---|
| … | … | |
| 826 | 828 | body |
|---|
| 827 | 829 | { |
|---|
| 828 | | auto zipfolder = cast(ZipFolder) folder; |
|---|
| | 830 | auto zipfolder = cast(ZipSubFolder) folder; |
|---|
| 829 | 831 | |
|---|
| 830 | 832 | if( mounting |
|---|
| … | … | |
| 844 | 846 | |
|---|
| 845 | 847 | /** |
|---|
| 846 | | * Returns a reference to the underlying ZipArchive instance. |
|---|
| | 848 | * Returns a reference to the underlying ZipFolder instance. |
|---|
| 847 | 849 | */ |
|---|
| 848 | | final ZipArchive archive() { return _archive; } |
|---|
| | 850 | final ZipFolder archive() { return _archive; } |
|---|
| 849 | 851 | |
|---|
| 850 | 852 | private: |
|---|
| 851 | | ZipArchive _archive; |
|---|
| | 853 | ZipFolder _archive; |
|---|
| 852 | 854 | Entry* entry; |
|---|
| 853 | 855 | VfsStats stats; |
|---|
| 854 | 856 | |
|---|
| 855 | | final ZipArchive archive(ZipArchive v) { return _archive = v; } |
|---|
| 856 | | |
|---|
| 857 | | this(ZipArchive archive, Entry* entry) |
|---|
| | 857 | final ZipFolder archive(ZipFolder v) { return _archive = v; } |
|---|
| | 858 | |
|---|
| | 859 | this(ZipFolder archive, Entry* entry) |
|---|
| 858 | 860 | { |
|---|
| 859 | 861 | this.reset(archive, entry); |
|---|
| 860 | 862 | } |
|---|
| 861 | 863 | |
|---|
| 862 | | final void reset(ZipArchive archive, Entry* entry) |
|---|
| | 864 | final void reset(ZipFolder archive, Entry* entry) |
|---|
| 863 | 865 | in |
|---|
| 864 | 866 | { |
|---|
| … | … | |
| 895 | 897 | } |
|---|
| 896 | 898 | |
|---|
| 897 | | final ZipFolder[] folders(bool collect) |
|---|
| 898 | | in { assert( valid ); } |
|---|
| 899 | | body |
|---|
| 900 | | { |
|---|
| 901 | | ZipFolder[] folders; |
|---|
| | 899 | final ZipSubFolder[] folders(bool collect) |
|---|
| | 900 | in { assert( valid ); } |
|---|
| | 901 | body |
|---|
| | 902 | { |
|---|
| | 903 | ZipSubFolder[] folders; |
|---|
| 902 | 904 | stats = stats.init; |
|---|
| 903 | 905 | |
|---|
| … | … | |
| 906 | 908 | if( childEntry.isDir ) |
|---|
| 907 | 909 | { |
|---|
| 908 | | if( collect ) folders ~= new ZipFolder(archive, childEntry); |
|---|
| | 910 | if( collect ) folders ~= new ZipSubFolder(archive, childEntry); |
|---|
| 909 | 911 | ++ stats.folders; |
|---|
| 910 | 912 | } |
|---|
| … | … | |
| 994 | 996 | body |
|---|
| 995 | 997 | { |
|---|
| 996 | | version( ZipArchive_NonMutating ) |
|---|
| | 998 | version( ZipFolder_NonMutating ) |
|---|
| 997 | 999 | { |
|---|
| 998 | 1000 | mutate_error("ZipFile.copy"); |
|---|
| … | … | |
| 1016 | 1018 | body |
|---|
| 1017 | 1019 | { |
|---|
| 1018 | | version( ZipArchive_NonMutating ) |
|---|
| | 1020 | version( ZipFolder_NonMutating ) |
|---|
| 1019 | 1021 | { |
|---|
| 1020 | 1022 | mutate_error("ZipFile.move"); |
|---|
| … | … | |
| 1039 | 1041 | body |
|---|
| 1040 | 1042 | { |
|---|
| 1041 | | version( ZipArchive_NonMutating ) |
|---|
| | 1043 | version( ZipFolder_NonMutating ) |
|---|
| 1042 | 1044 | { |
|---|
| 1043 | 1045 | mutate_error("ZipFile.create"); |
|---|
| … | … | |
| 1074 | 1076 | body |
|---|
| 1075 | 1077 | { |
|---|
| 1076 | | version( ZipArchive_NonMutating ) |
|---|
| | 1078 | version( ZipFolder_NonMutating ) |
|---|
| 1077 | 1079 | { |
|---|
| 1078 | 1080 | mutate_error("ZipFile.create"); |
|---|
| … | … | |
| 1093 | 1095 | body |
|---|
| 1094 | 1096 | { |
|---|
| 1095 | | version( ZipArchive_NonMutating ) |
|---|
| | 1097 | version( ZipFolder_NonMutating ) |
|---|
| 1096 | 1098 | { |
|---|
| 1097 | 1099 | mutate_error("ZipFile.remove"); |
|---|
| … | … | |
| 1143 | 1145 | body |
|---|
| 1144 | 1146 | { |
|---|
| 1145 | | version( ZipArchive_NonMutable ) |
|---|
| | 1147 | version( ZipFolder_NonMutable ) |
|---|
| 1146 | 1148 | { |
|---|
| 1147 | 1149 | mutate_error("ZipFile.output"); |
|---|
| … | … | |
| 1171 | 1173 | |
|---|
| 1172 | 1174 | private: |
|---|
| 1173 | | ZipArchive archive; |
|---|
| | 1175 | ZipFolder archive; |
|---|
| 1174 | 1176 | Entry* entry; |
|---|
| 1175 | 1177 | |
|---|
| … | … | |
| 1183 | 1185 | } |
|---|
| 1184 | 1186 | |
|---|
| 1185 | | this(ZipArchive archive, Entry* parent, Entry* entry) |
|---|
| | 1187 | this(ZipFolder archive, Entry* parent, Entry* entry) |
|---|
| 1186 | 1188 | in |
|---|
| 1187 | 1189 | { |
|---|
| … | … | |
| 1199 | 1201 | } |
|---|
| 1200 | 1202 | |
|---|
| 1201 | | this(ZipArchive archive, Entry* parent, char[] name) |
|---|
| | 1203 | this(ZipFolder archive, Entry* parent, char[] name) |
|---|
| 1202 | 1204 | in |
|---|
| 1203 | 1205 | { |
|---|
| … | … | |
| 1236 | 1238 | } |
|---|
| 1237 | 1239 | |
|---|
| 1238 | | final void reset(ZipArchive archive, Entry* parent, Entry* entry) |
|---|
| | 1240 | final void reset(ZipFolder archive, Entry* parent, Entry* entry) |
|---|
| 1239 | 1241 | in |
|---|
| 1240 | 1242 | { |
|---|
| … | … | |
| 1255 | 1257 | } |
|---|
| 1256 | 1258 | |
|---|
| 1257 | | final void reset(ZipArchive archive, Entry* parent, char[] name) |
|---|
| | 1259 | final void reset(ZipFolder archive, Entry* parent, char[] name) |
|---|
| 1258 | 1260 | in |
|---|
| 1259 | 1261 | { |
|---|
| … | … | |
| 1288 | 1290 | // ************************************************************************ // |
|---|
| 1289 | 1291 | |
|---|
| 1290 | | class ZipFolderEntry : VfsFolderEntry |
|---|
| | 1292 | class ZipSubFolderEntry : VfsFolderEntry |
|---|
| 1291 | 1293 | { |
|---|
| 1292 | 1294 | final override VfsFolder open() |
|---|
| … | … | |
| 1296 | 1298 | auto entry = (name in parent.dir.children); |
|---|
| 1297 | 1299 | if( entry ) |
|---|
| 1298 | | return new ZipFolder(archive, *entry); |
|---|
| | 1300 | return new ZipSubFolder(archive, *entry); |
|---|
| 1299 | 1301 | |
|---|
| 1300 | 1302 | else |
|---|
| 1301 | 1303 | { |
|---|
| 1302 | 1304 | // NOTE: this can be called with a multi-part path. |
|---|
| 1303 | | error("ZipFolderEntry.open: \"" |
|---|
| | 1305 | error("ZipSubFolderEntry.open: \"" |
|---|
| 1304 | 1306 | ~ parent.fullname ~ "/" ~ name |
|---|
| 1305 | 1307 | ~ "\" does not exist"); |
|---|
| … | … | |
| 1311 | 1313 | body |
|---|
| 1312 | 1314 | { |
|---|
| 1313 | | version( ZipArchive_NonMutating ) |
|---|
| | 1315 | version( ZipFolder_NonMutating ) |
|---|
| 1314 | 1316 | { |
|---|
| 1315 | 1317 | // TODO: different exception if folder exists (this operation is |
|---|
| 1316 | 1318 | // currently invalid either way...) |
|---|
| 1317 | | mutate_error("ZipFolderEntry.create"); |
|---|
| | 1319 | mutate_error("ZipSubFolderEntry.create"); |
|---|
| 1318 | 1320 | assert(false); |
|---|
| 1319 | 1321 | } |
|---|
| … | … | |
| 1325 | 1327 | // If the folder exists, we can't really create it, now can we? |
|---|
| 1326 | 1328 | if( this.exists ) |
|---|
| 1327 | | error("ZipFolderEntry.create: cannot create folder that already " |
|---|
| | 1329 | error("ZipSubFolderEntry.create: cannot create folder that already " |
|---|
| 1328 | 1330 | "exists, and believe me, I *tried*"); |
|---|
| 1329 | 1331 | |
|---|
| … | … | |
| 1340 | 1342 | |
|---|
| 1341 | 1343 | // Done |
|---|
| 1342 | | return new ZipFolder(archive, entry); |
|---|
| | 1344 | return new ZipSubFolder(archive, entry); |
|---|
| 1343 | 1345 | } |
|---|
| 1344 | 1346 | } |
|---|
| … | … | |
| 1352 | 1354 | |
|---|
| 1353 | 1355 | private: |
|---|
| 1354 | | ZipArchive archive; |
|---|
| | 1356 | ZipFolder archive; |
|---|
| 1355 | 1357 | Entry* parent; |
|---|
| 1356 | 1358 | char[] name; |
|---|
| 1357 | 1359 | |
|---|
| 1358 | | this(ZipArchive archive, Entry* parent, char[] name) |
|---|
| | 1360 | this(ZipFolder archive, Entry* parent, char[] name) |
|---|
| 1359 | 1361 | in |
|---|
| 1360 | 1362 | { |
|---|
| … | … | |
| 1398 | 1400 | // ************************************************************************ // |
|---|
| 1399 | 1401 | |
|---|
| 1400 | | class ZipFolderGroup : VfsFolders |
|---|
| | 1402 | class ZipSubFolderGroup : VfsFolders |
|---|
| 1401 | 1403 | { |
|---|
| 1402 | 1404 | final override int opApply(int delegate(ref VfsFolder) dg) |
|---|
| … | … | |
| 1458 | 1460 | body |
|---|
| 1459 | 1461 | { |
|---|
| 1460 | | ZipFolder[] set; |
|---|
| | 1462 | ZipSubFolder[] set; |
|---|
| 1461 | 1463 | |
|---|
| 1462 | 1464 | foreach( folder ; members ) |
|---|
| … | … | |
| 1464 | 1466 | set ~= folder; |
|---|
| 1465 | 1467 | |
|---|
| 1466 | | return new ZipFolderGroup(archive, set); |
|---|
| | 1468 | return new ZipSubFolderGroup(archive, set); |
|---|
| 1467 | 1469 | } |
|---|
| 1468 | 1470 | |
|---|
| … | … | |
| 1487 | 1489 | |
|---|
| 1488 | 1490 | private: |
|---|
| 1489 | | ZipArchive archive; |
|---|
| 1490 | | ZipFolder[] members; |
|---|
| 1491 | | |
|---|
| 1492 | | this(ZipArchive archive, ZipFolder root, bool recurse) |
|---|
| | 1491 | ZipFolder archive; |
|---|
| | 1492 | ZipSubFolder[] members; |
|---|
| | 1493 | |
|---|
| | 1494 | this(ZipFolder archive, ZipSubFolder root, bool recurse) |
|---|
| 1493 | 1495 | out { assert( valid ); } |
|---|
| 1494 | 1496 | body |
|---|
| … | … | |
| 1498 | 1500 | } |
|---|
| 1499 | 1501 | |
|---|
| 1500 | | this(ZipArchive archive, ZipFolder[] members) |
|---|
| | 1502 | this(ZipFolder archive, ZipSubFolder[] members) |
|---|
| 1501 | 1503 | out { assert( valid ); } |
|---|
| 1502 | 1504 | body |
|---|
| … | … | |
| 1511 | 1513 | } |
|---|
| 1512 | 1514 | |
|---|
| 1513 | | final ZipFolder[] scan(ZipFolder root, bool recurse) |
|---|
| | 1515 | final ZipSubFolder[] scan(ZipSubFolder root, bool recurse) |
|---|
| 1514 | 1516 | in { assert( valid ); } |
|---|
| 1515 | 1517 | body |
|---|
| … | … | |
| 1563 | 1565 | |
|---|
| 1564 | 1566 | private: |
|---|
| 1565 | | ZipArchive archive; |
|---|
| | 1567 | ZipFolder archive; |
|---|
| 1566 | 1568 | FileEntry[] group; |
|---|
| 1567 | 1569 | VfsStats stats; |
|---|
| … | … | |
| 1573 | 1575 | } |
|---|
| 1574 | 1576 | |
|---|
| 1575 | | this(ZipArchive archive, ZipFolderGroup host, VfsFilter filter) |
|---|
| | 1577 | this(ZipFolder archive, ZipSubFolderGroup host, VfsFilter filter) |
|---|
| 1576 | 1578 | out { assert( valid ); } |
|---|
| 1577 | 1579 | body |
|---|
| … | … | |
| 1601 | 1603 | void mutate_error(char[] method) |
|---|
| 1602 | 1604 | { |
|---|
| 1603 | | error(method ~ ": mutating the contents of a ZipArchive " |
|---|
| | 1605 | error(method ~ ": mutating the contents of a ZipFolder " |
|---|
| 1604 | 1606 | "is not supported yet; terribly sorry"); |
|---|
| 1605 | 1607 | } |
|---|
Download in other formats:
|
 |