 |
Changeset 3647
- Timestamp:
- 06/19/08 19:26:09
(3 months ago)
- Author:
- kris
- Message:
update to focus on char[] paths instead of FilePath?
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3604 |
r3647 |
|
| 40 | 40 | import tango.time.chrono.Gregorian : Gregorian; |
|---|
| 41 | 41 | |
|---|
| | 42 | import Path = tango.io.Path; |
|---|
| 42 | 43 | import Integer = tango.text.convert.Integer; |
|---|
| 43 | 44 | |
|---|
| … | … | |
| 541 | 542 | void finish(); |
|---|
| 542 | 543 | void putFile(ZipEntryInfo info, char[] path); |
|---|
| 543 | | void putFile(ZipEntryInfo info, PathView path); |
|---|
| | 544 | deprecated void putFile(ZipEntryInfo info, PathView path); |
|---|
| | 545 | void putFile(ZipEntryInfo info, char[] path); |
|---|
| 544 | 546 | void putStream(ZipEntryInfo info, InputStream source); |
|---|
| 545 | 547 | void putEntry(ZipEntryInfo info, ZipEntry entry); |
|---|
| … | … | |
| 586 | 588 | * filesystem. |
|---|
| 587 | 589 | */ |
|---|
| | 590 | deprecated this(PathView path) |
|---|
| | 591 | { |
|---|
| | 592 | this(path.toString); |
|---|
| | 593 | } |
|---|
| | 594 | |
|---|
| | 595 | /// ditto |
|---|
| 588 | 596 | this(char[] path) |
|---|
| 589 | | { |
|---|
| 590 | | this(FilePath(path)); |
|---|
| 591 | | } |
|---|
| 592 | | |
|---|
| 593 | | /// ditto |
|---|
| 594 | | this(PathView path) |
|---|
| 595 | 597 | { |
|---|
| 596 | 598 | file_source = new FileConduit(path); |
|---|
| … | … | |
| 991 | 993 | * filesystem. |
|---|
| 992 | 994 | */ |
|---|
| | 995 | deprecated this(FilePath path) |
|---|
| | 996 | { |
|---|
| | 997 | this(path.toString); |
|---|
| | 998 | } |
|---|
| | 999 | |
|---|
| | 1000 | /// ditto |
|---|
| 993 | 1001 | this(char[] path) |
|---|
| 994 | | { |
|---|
| 995 | | this(FilePath(path)); |
|---|
| 996 | | } |
|---|
| 997 | | |
|---|
| 998 | | /// ditto |
|---|
| 999 | | this(PathView path) |
|---|
| 1000 | 1002 | { |
|---|
| 1001 | 1003 | file_output = new FileConduit(path, FileConduit.WriteCreate); |
|---|
| … | … | |
| 1039 | 1041 | * Adds a file from the local filesystem to the archive. |
|---|
| 1040 | 1042 | */ |
|---|
| | 1043 | deprecated void putFile(ZipEntryInfo info, PathView path) |
|---|
| | 1044 | { |
|---|
| | 1045 | putFile(info, path.toString); |
|---|
| | 1046 | } |
|---|
| | 1047 | |
|---|
| | 1048 | /// ditto |
|---|
| 1041 | 1049 | void putFile(ZipEntryInfo info, char[] path) |
|---|
| 1042 | | { |
|---|
| 1043 | | putFile(info, FilePath(path)); |
|---|
| 1044 | | } |
|---|
| 1045 | | |
|---|
| 1046 | | /// ditto |
|---|
| 1047 | | void putFile(ZipEntryInfo info, PathView path) |
|---|
| 1048 | 1050 | { |
|---|
| 1049 | 1051 | scope file = new FileConduit(path); |
|---|
| … | … | |
| 1749 | 1751 | } |
|---|
| 1750 | 1752 | |
|---|
| 1751 | | void createArchive(PathView archive, Method method, PathView[] files...) |
|---|
| 1752 | | { |
|---|
| 1753 | | scope zw = new ZipBlockWriter(archive); |
|---|
| | 1753 | deprecated void createArchive(PathView archive, Method method, PathView[] files...) |
|---|
| | 1754 | { |
|---|
| | 1755 | scope zw = new ZipBlockWriter(archive.toString); |
|---|
| 1754 | 1756 | zw.method = method; |
|---|
| 1755 | 1757 | |
|---|
| 1756 | 1758 | foreach( file ; files ) |
|---|
| 1757 | | zw.putFile(ZipEntryInfo(file.toString), file); |
|---|
| | 1759 | zw.putFile(ZipEntryInfo(file.toString), file.toString); |
|---|
| 1758 | 1760 | |
|---|
| 1759 | 1761 | zw.finish; |
|---|
| 1760 | 1762 | } |
|---|
| 1761 | 1763 | |
|---|
| 1762 | | void extractArchive(char[] archive, char[] folder) |
|---|
| 1763 | | { |
|---|
| 1764 | | extractArchive(FilePath(archive), FilePath(folder)); |
|---|
| 1765 | | } |
|---|
| 1766 | | |
|---|
| 1767 | | void extractArchive(PathView archive, PathView dest) |
|---|
| 1768 | | { |
|---|
| 1769 | | scope folder = FilePath(dest.toString); |
|---|
| | 1764 | deprecated void extractArchive(FilePath archive, char[] folder) |
|---|
| | 1765 | { |
|---|
| | 1766 | extractArchive(archive, folder); |
|---|
| | 1767 | } |
|---|
| | 1768 | |
|---|
| | 1769 | deprecated void extractArchive(PathView archive, PathView dest) |
|---|
| | 1770 | { |
|---|
| | 1771 | extractArchive (archive.toString, dest.toString); |
|---|
| | 1772 | } |
|---|
| | 1773 | |
|---|
| | 1774 | void extractArchive(char[] archive, char[] dest) |
|---|
| | 1775 | { |
|---|
| 1770 | 1776 | scope zr = new ZipBlockReader(archive); |
|---|
| 1771 | 1777 | |
|---|
| … | … | |
| 1775 | 1781 | if( entry.info.name[$-1] == '/' ) continue; |
|---|
| 1776 | 1782 | |
|---|
| 1777 | | auto path = folder.dup.append(entry.info.name); |
|---|
| | 1783 | auto path = Path.join(dest, entry.info.name); |
|---|
| 1778 | 1784 | scope fout = new FileConduit(path, FileConduit.WriteCreate); |
|---|
| 1779 | 1785 | fout.output.copy(entry.open); |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic