 |
Changeset 3648
- Timestamp:
- 06/19/08 20:26:03
(3 months ago)
- Author:
- kris
- Message:
fixes for char[]/FilePath change
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r3605 |
r3648 |
|
| 25 | 25 | VfsInfo, VfsSync; |
|---|
| 26 | 26 | import tango.util.PathUtil : patternMatch; |
|---|
| | 27 | import Path = tango.io.Path; |
|---|
| 27 | 28 | |
|---|
| 28 | 29 | debug( ZipFolder ) |
|---|
| … | … | |
| 288 | 289 | * explicitly disallowed. |
|---|
| 289 | 290 | */ |
|---|
| 290 | | this(char[] path, bool readonly=false) |
|---|
| | 291 | deprecated this(FilePath path, bool readonly=false) |
|---|
| 291 | 292 | out { assert( valid ); } |
|---|
| 292 | 293 | body |
|---|
| … | … | |
| 294 | 295 | debug( ZipFolder ) |
|---|
| 295 | 296 | Stderr.formatln(`ZipFolder("{}", {})`, path, readonly); |
|---|
| 296 | | this(FilePath(path), readonly); |
|---|
| | 297 | this(path.toString, readonly); |
|---|
| 297 | 298 | } |
|---|
| 298 | 299 | |
|---|
| 299 | 300 | /// ditto |
|---|
| 300 | | this(FilePath path, bool readonly=false) |
|---|
| | 301 | this(char[] path, bool readonly=false) |
|---|
| 301 | 302 | out { assert( valid ); } |
|---|
| 302 | 303 | body |
|---|
| … | … | |
| 374 | 375 | scope(exit) if( tempFile !is null ) delete tempFile; |
|---|
| 375 | 376 | |
|---|
| | 377 | auto p = Path.parse (path); |
|---|
| 376 | 378 | foreach( file ; this.tree.catalog ) |
|---|
| 377 | 379 | { |
|---|
| … | … | |
| 379 | 381 | if( zf.entry.file.zipEntry !is null ) |
|---|
| 380 | 382 | { |
|---|
| 381 | | tempFile = new TempFile(path.path, TempFile.Permanent); |
|---|
| | 383 | tempFile = new TempFile(p.path, TempFile.Permanent); |
|---|
| 382 | 384 | os = tempFile.output; |
|---|
| 383 | 385 | debug( ZipFolder ) |
|---|
| … | … | |
| 471 | 473 | * flushed to disk. |
|---|
| 472 | 474 | */ |
|---|
| 473 | | final FilePath path() { return _path; } |
|---|
| 474 | | final FilePath path(FilePath v) { return _path = v; } /// ditto |
|---|
| | 475 | //deprecated final FilePath path() { return FilePath(_path); } |
|---|
| | 476 | //deprecated final void path(FilePath v) { return _path = v.toString; } /// ditto |
|---|
| | 477 | |
|---|
| | 478 | /** |
|---|
| | 479 | * Allows you to read and specify the path to the archive. The effect of |
|---|
| | 480 | * setting this is to change where the archive will be written to when |
|---|
| | 481 | * flushed to disk. |
|---|
| | 482 | */ |
|---|
| | 483 | final char[] path() { return _path; } |
|---|
| | 484 | final char[] path(char[] v) { return _path = v; } /// ditto |
|---|
| 475 | 485 | |
|---|
| 476 | 486 | private: |
|---|
| 477 | 487 | ZipReader zr; |
|---|
| 478 | 488 | Entry* root; |
|---|
| 479 | | FilePath _path; |
|---|
| | 489 | char[] _path; |
|---|
| 480 | 490 | bool _readonly; |
|---|
| 481 | 491 | bool modified = false; |
|---|
| … | … | |
| 513 | 523 | } |
|---|
| 514 | 524 | |
|---|
| 515 | | void resetArchive(FilePath path, bool readonly=false) |
|---|
| | 525 | void resetArchive(char[] path, bool readonly=false) |
|---|
| 516 | 526 | out { assert( valid ); } |
|---|
| 517 | 527 | body |
|---|
| … | … | |
| 524 | 534 | |
|---|
| 525 | 535 | this.path = path; |
|---|
| 526 | | this.readonly = readonly & !path.isWritable; |
|---|
| 527 | | |
|---|
| 528 | | zr = new ZipBlockReader(path.toString); |
|---|
| | 536 | this.readonly = readonly & !Path.isWritable(path); |
|---|
| | 537 | |
|---|
| | 538 | zr = new ZipBlockReader(path); |
|---|
| 529 | 539 | |
|---|
| 530 | 540 | // First, create a root entry |
|---|
| … | … | |
| 650 | 660 | { |
|---|
| 651 | 661 | assert( valid ); |
|---|
| 652 | | assert( !FilePath(path).isAbsolute ); |
|---|
| 653 | | } |
|---|
| 654 | | body |
|---|
| 655 | | { |
|---|
| 656 | | auto fp = FilePath(path); |
|---|
| | 662 | assert( !Path.parse(path).isAbsolute ); |
|---|
| | 663 | } |
|---|
| | 664 | body |
|---|
| | 665 | { |
|---|
| | 666 | auto fp = Path.parse(path); |
|---|
| 657 | 667 | auto dir = fp.path; |
|---|
| 658 | 668 | auto name = fp.file; |
|---|
| … | … | |
| 692 | 702 | { |
|---|
| 693 | 703 | assert( valid ); |
|---|
| 694 | | assert( !FilePath(path).isAbsolute ); |
|---|
| | 704 | assert( !Path.parse(path).isAbsolute ); |
|---|
| 695 | 705 | } |
|---|
| 696 | 706 | body |
|---|
| … | … | |
| 846 | 856 | if( src[0..len] == dst[0..len] ) |
|---|
| 847 | 857 | error(`folders "`~dst~`" and "`~src~`" in archive "` |
|---|
| 848 | | ~archive.path.toString~`" overlap`); |
|---|
| | 858 | ~archive.path~`" overlap`); |
|---|
| 849 | 859 | } |
|---|
| 850 | 860 | } |
|---|
| … | … | |
| 1640 | 1650 | } |
|---|
| 1641 | 1651 | |
|---|
| 1642 | | void headTail(ref FilePath fp, out char[] head, out char[] tail) |
|---|
| | 1652 | deprecated void headTail(ref FilePath fp, out char[] head, out char[] tail) |
|---|
| 1643 | 1653 | { |
|---|
| 1644 | 1654 | return headTail(fp.toString, head, tail); |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic