 |
Changeset 2543
- Timestamp:
- 09/03/07 01:12:01
(1 year ago)
- Author:
- kris
- Message:
removed indirect mutating methods from PathView?, so that it is more compatible with VFS
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2517 |
r2543 |
|
| 94 | 94 | folder_, // path before name |
|---|
| 95 | 95 | suffix_; // after rightmost '.' |
|---|
| | 96 | |
|---|
| | 97 | /*********************************************************************** |
|---|
| | 98 | |
|---|
| | 99 | Filter used for screening paths via toList() |
|---|
| | 100 | |
|---|
| | 101 | ***********************************************************************/ |
|---|
| | 102 | |
|---|
| | 103 | public alias bool delegate (FilePath, bool) Filter; |
|---|
| 96 | 104 | |
|---|
| 97 | 105 | |
|---|
| … | … | |
| 625 | 633 | /*********************************************************************** |
|---|
| 626 | 634 | |
|---|
| 627 | | List the set of filenames within this directory. All |
|---|
| | 635 | List the set of filenames within this folder. All |
|---|
| 628 | 636 | filenames are null terminated, though the null itself |
|---|
| 629 | 637 | is hidden at the end of each name (not exposed by the |
|---|
| … | … | |
| 658 | 666 | /*********************************************************************** |
|---|
| 659 | 667 | |
|---|
| 660 | | List the set of filenames within this directory, using |
|---|
| | 668 | List the set of filenames within this folder, using |
|---|
| 661 | 669 | the provided filter to control the list: |
|---|
| 662 | 670 | --- |
|---|
| … | … | |
| 1126 | 1134 | /*************************************************************** |
|---|
| 1127 | 1135 | |
|---|
| 1128 | | List the set of filenames within this directory. |
|---|
| 1129 | | |
|---|
| 1130 | | All filenames are null terminated and are passed |
|---|
| 1131 | | to the provided delegate as such, along with the |
|---|
| 1132 | | path prefix and whether the entry is a directory |
|---|
| 1133 | | or not. |
|---|
| 1134 | | |
|---|
| 1135 | | ***************************************************************/ |
|---|
| 1136 | | |
|---|
| 1137 | | final FilePath toList (void delegate (char[] path, char[] file, bool dir) dg) |
|---|
| | 1136 | List the set of filenames within this folder. |
|---|
| | 1137 | |
|---|
| | 1138 | Each path and filename is passed to the provided |
|---|
| | 1139 | delegate, along with the path prefix and whether |
|---|
| | 1140 | the entry is a folder or not. |
|---|
| | 1141 | |
|---|
| | 1142 | Returns the number of files scanned. |
|---|
| | 1143 | |
|---|
| | 1144 | ***************************************************************/ |
|---|
| | 1145 | |
|---|
| | 1146 | final uint toList (void delegate (char[] path, char[] file, bool dir) dg) |
|---|
| 1138 | 1147 | { |
|---|
| 1139 | 1148 | HANDLE h; |
|---|
| | 1149 | uint count; |
|---|
| 1140 | 1150 | char[] prefix; |
|---|
| 1141 | 1151 | char[MAX_PATH+1] tmp = void; |
|---|
| … | … | |
| 1186 | 1196 | // skip hidden/system files |
|---|
| 1187 | 1197 | if ((fileinfo.dwFileAttributes & (FILE_ATTRIBUTE_SYSTEM | FILE_ATTRIBUTE_HIDDEN)) is 0) |
|---|
| 1188 | | dg (prefix, str, (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); |
|---|
| | 1198 | { |
|---|
| | 1199 | dg (prefix, str, (fileinfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0); |
|---|
| | 1200 | ++count; |
|---|
| | 1201 | } |
|---|
| 1189 | 1202 | |
|---|
| 1190 | 1203 | } while (next); |
|---|
| 1191 | 1204 | |
|---|
| 1192 | | return this; |
|---|
| | 1205 | return count; |
|---|
| 1193 | 1206 | } |
|---|
| 1194 | 1207 | } |
|---|
| … | … | |
| 1410 | 1423 | /*************************************************************** |
|---|
| 1411 | 1424 | |
|---|
| 1412 | | List the set of filenames within this directory. |
|---|
| 1413 | | |
|---|
| 1414 | | All filenames are null terminated and are passed |
|---|
| 1415 | | to the provided delegate as such, along with the |
|---|
| 1416 | | path prefix and whether the entry is a directory |
|---|
| 1417 | | or not. |
|---|
| 1418 | | |
|---|
| 1419 | | ***************************************************************/ |
|---|
| 1420 | | |
|---|
| 1421 | | final FilePath toList (void delegate (char[] path, char[] file, bool dir) dg) |
|---|
| | 1425 | List the set of filenames within this folder. |
|---|
| | 1426 | |
|---|
| | 1427 | Each path and filename is passed to the provided |
|---|
| | 1428 | delegate, along with the path prefix and whether |
|---|
| | 1429 | the entry is a folder or not. |
|---|
| | 1430 | |
|---|
| | 1431 | Returns the number of files scanned. |
|---|
| | 1432 | |
|---|
| | 1433 | ***************************************************************/ |
|---|
| | 1434 | |
|---|
| | 1435 | final uint toList (void delegate (char[] path, char[] file, bool dir) dg) |
|---|
| 1422 | 1436 | { |
|---|
| 1423 | 1437 | DIR* dir; |
|---|
| … | … | |
| 1426 | 1440 | char[] prefix; |
|---|
| 1427 | 1441 | char[] sfnbuf; |
|---|
| | 1442 | uint count; |
|---|
| 1428 | 1443 | |
|---|
| 1429 | 1444 | dir = tango.stdc.posix.dirent.opendir (this.cString.ptr); |
|---|
| … | … | |
| 1457 | 1472 | : (sbuf.st_mode & S_IFDIR) != 0; |
|---|
| 1458 | 1473 | dg (prefix, str, isDir); |
|---|
| | 1474 | ++count; |
|---|
| 1459 | 1475 | } |
|---|
| 1460 | 1476 | |
|---|
| 1461 | | return this; |
|---|
| | 1477 | return count; |
|---|
| 1462 | 1478 | } |
|---|
| 1463 | 1479 | } |
|---|
| … | … | |
| 1472 | 1488 | interface PathView |
|---|
| 1473 | 1489 | { |
|---|
| 1474 | | public alias bool delegate (FilePath, bool) Filter; |
|---|
| 1475 | | |
|---|
| 1476 | 1490 | /*********************************************************************** |
|---|
| 1477 | 1491 | |
|---|
| … | … | |
| 1630 | 1644 | /*********************************************************************** |
|---|
| 1631 | 1645 | |
|---|
| 1632 | | Create an entire path consisting of this folder along with |
|---|
| 1633 | | all parent folders. The path must not contain '.' or '..' |
|---|
| 1634 | | segments. Related methods include PathUtil.normalize() and |
|---|
| 1635 | | FileSystem.absolutePath() |
|---|
| 1636 | | |
|---|
| 1637 | | Returns: a chaining reference (this) |
|---|
| 1638 | | |
|---|
| 1639 | | Throws: IOException upon systen errors |
|---|
| 1640 | | |
|---|
| 1641 | | Throws: IllegalArgumentException if the path contains invalid |
|---|
| 1642 | | path segment names (such as '.' or '..') or a segment |
|---|
| 1643 | | exists but as a file instead of a folder |
|---|
| 1644 | | |
|---|
| 1645 | | ***********************************************************************/ |
|---|
| 1646 | | |
|---|
| 1647 | | abstract FilePath create (); |
|---|
| 1648 | | |
|---|
| 1649 | | /*********************************************************************** |
|---|
| 1650 | | |
|---|
| 1651 | | Create a new file |
|---|
| 1652 | | |
|---|
| 1653 | | ***********************************************************************/ |
|---|
| 1654 | | |
|---|
| 1655 | | abstract FilePath createFile (); |
|---|
| 1656 | | |
|---|
| 1657 | | /*********************************************************************** |
|---|
| 1658 | | |
|---|
| 1659 | | Create a new directory |
|---|
| 1660 | | |
|---|
| 1661 | | ***********************************************************************/ |
|---|
| 1662 | | |
|---|
| 1663 | | abstract FilePath createFolder (); |
|---|
| 1664 | | |
|---|
| 1665 | | /*********************************************************************** |
|---|
| 1666 | | |
|---|
| 1667 | 1646 | Return the file length (in bytes) |
|---|
| 1668 | 1647 | |
|---|
| … | … | |
| 1694 | 1673 | |
|---|
| 1695 | 1674 | abstract Stamps timeStamps (); |
|---|
| 1696 | | |
|---|
| 1697 | | /*********************************************************************** |
|---|
| 1698 | | |
|---|
| 1699 | | List the set of filenames within this directory, using |
|---|
| 1700 | | the provided filter to control the list: |
|---|
| 1701 | | --- |
|---|
| 1702 | | bool delegate (FilePath path, bool isFolder) Filter |
|---|
| 1703 | | --- |
|---|
| 1704 | | |
|---|
| 1705 | | Returning true from the filter includes the given path, |
|---|
| 1706 | | whilst returning false excludes it. Parameter 'isFolder' |
|---|
| 1707 | | indicates whether the path is a file or folder |
|---|
| 1708 | | |
|---|
| 1709 | | Note that paths composed of '.' characters are ignored. |
|---|
| 1710 | | |
|---|
| 1711 | | ***********************************************************************/ |
|---|
| 1712 | | |
|---|
| 1713 | | abstract FilePath[] toList (Filter filter = null); |
|---|
| 1714 | | |
|---|
| 1715 | | /*********************************************************************** |
|---|
| 1716 | | |
|---|
| 1717 | | List the set of filenames within this directory. |
|---|
| 1718 | | |
|---|
| 1719 | | All filenames are null terminated and are passed |
|---|
| 1720 | | to the provided delegate as such, along with the |
|---|
| 1721 | | path prefix and whether the entry is a directory |
|---|
| 1722 | | or not. |
|---|
| 1723 | | |
|---|
| 1724 | | ***********************************************************************/ |
|---|
| 1725 | | |
|---|
| 1726 | | abstract FilePath toList (void delegate (char[], char[], bool) dg); |
|---|
| 1727 | 1675 | } |
|---|
| 1728 | 1676 | |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic