 |
Changeset 2837
- Timestamp:
- 11/09/07 23:30:03
(1 year ago)
- Author:
- kris
- Message:
moved 'name' options around, and added some more doc
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r2818 |
r2837 |
|
| 35 | 35 | private FilePath path; |
|---|
| 36 | 36 | private VfsStats stats; |
|---|
| 37 | | private char[] name_; |
|---|
| 38 | 37 | |
|---|
| 39 | 38 | /*********************************************************************** |
|---|
| … | … | |
| 48 | 47 | ***********************************************************************/ |
|---|
| 49 | 48 | |
|---|
| 50 | | this (char[] name, char[] path, bool create=false) |
|---|
| | 49 | this (char[] path, bool create=false) |
|---|
| 51 | 50 | { |
|---|
| 52 | 51 | this.path = open (FilePath(path), create); |
|---|
| 53 | | name_ = name; |
|---|
| 54 | 52 | } |
|---|
| 55 | 53 | |
|---|
| … | … | |
| 85 | 83 | final char[] name () |
|---|
| 86 | 84 | { |
|---|
| 87 | | auto name = name_; |
|---|
| 88 | | if (name.ptr is null) |
|---|
| 89 | | name = path.name; |
|---|
| 90 | | return name; |
|---|
| | 85 | return path.name; |
|---|
| 91 | 86 | } |
|---|
| 92 | 87 | |
|---|
| r2809 |
r2837 |
|
| 76 | 76 | we subsequently traverse when looking up a file |
|---|
| 77 | 77 | |
|---|
| | 78 | The second argument represents an optional name that the |
|---|
| | 79 | mount should be known as, instead of the name exposed by |
|---|
| | 80 | the provided folder (it is not an alias). |
|---|
| | 81 | |
|---|
| 78 | 82 | ***********************************************************************/ |
|---|
| 79 | 83 | |
|---|
| 80 | | final VfsHost mount (VfsFolder folder) |
|---|
| | 84 | final VfsHost mount (VfsFolder folder, char[] name=null) |
|---|
| 81 | 85 | { |
|---|
| 82 | 86 | // traverse to the end of the list |
|---|
| … | … | |
| 89 | 93 | |
|---|
| 90 | 94 | // and let superclass deal with it |
|---|
| 91 | | return super.mount (folder); |
|---|
| | 95 | return super.mount (folder, name); |
|---|
| 92 | 96 | } |
|---|
| 93 | 97 | |
|---|
| r2819 |
r2837 |
|
| 85 | 85 | tree of virtual folders are detected and trapped. |
|---|
| 86 | 86 | |
|---|
| 87 | | ***********************************************************************/ |
|---|
| 88 | | |
|---|
| 89 | | VfsHost mount (VfsFolder folder) |
|---|
| | 87 | The second argument represents an optional name that the |
|---|
| | 88 | mount should be known as, instead of the name exposed by |
|---|
| | 89 | the provided folder (it is not an alias). |
|---|
| | 90 | |
|---|
| | 91 | ***********************************************************************/ |
|---|
| | 92 | |
|---|
| | 93 | VfsHost mount (VfsFolder folder, char[] name = null) |
|---|
| 90 | 94 | { |
|---|
| 91 | 95 | assert (folder); |
|---|
| | 96 | if (name.length is 0) |
|---|
| | 97 | name = folder.name; |
|---|
| 92 | 98 | |
|---|
| 93 | 99 | // link virtual children to us |
|---|
| … | … | |
| 95 | 101 | if (child) |
|---|
| 96 | 102 | if (child.parent) |
|---|
| 97 | | error ("folder '"~folder.name~"' belongs to another host"); |
|---|
| | 103 | error ("folder '"~name~"' belongs to another host"); |
|---|
| 98 | 104 | else |
|---|
| 99 | 105 | child.parent = this; |
|---|
| … | … | |
| 103 | 109 | while (root.parent) |
|---|
| 104 | 110 | if (root is this) |
|---|
| 105 | | error ("circular reference detected while mounting '"~folder.name~"'"); |
|---|
| | 111 | error ("circular reference detected at '"~this.name~"' while mounting '"~name~"'"); |
|---|
| 106 | 112 | else |
|---|
| 107 | 113 | root = root.parent; |
|---|
| … | … | |
| 109 | 115 | |
|---|
| 110 | 116 | // all clear, so add the new folder |
|---|
| 111 | | mounts [folder.name] = folder; |
|---|
| | 117 | mounts [name] = folder; |
|---|
| 112 | 118 | return this; |
|---|
| 113 | 119 | } |
|---|
| … | … | |
| 563 | 569 | auto root = new VirtualFolder ("root"); |
|---|
| 564 | 570 | auto sub = new VirtualFolder ("sub"); |
|---|
| 565 | | sub.mount (new FileFolder ("tango", r"d:\d\import\tango")); |
|---|
| 566 | | |
|---|
| | 571 | sub.mount (new FileFolder (r"d:\d\import\tango")); |
|---|
| | 572 | |
|---|
| 567 | 573 | root.mount (sub) |
|---|
| 568 | | .mount (new FileFolder ("windows", r"c:\")) |
|---|
| 569 | | .mount (new FileFolder ("temp", r"d:\d\import\temp")); |
|---|
| | 574 | .mount (new FileFolder (r"c:\"), "windows") |
|---|
| | 575 | .mount (new FileFolder (r"d:\d\import\temp")); |
|---|
| 570 | 576 | |
|---|
| 571 | 577 | auto folder = root.folder (r"temp\bar"); |
|---|
| r2819 |
r2837 |
|
| 60 | 60 | tree of virtual folders are detected and trapped. |
|---|
| 61 | 61 | |
|---|
| | 62 | The second argument represents an optional name that the |
|---|
| | 63 | mount should be known as, instead of the name exposed by |
|---|
| | 64 | the provided folder (it is not an alias). |
|---|
| | 65 | |
|---|
| 62 | 66 | **********************************************************************/ |
|---|
| 63 | 67 | |
|---|
| 64 | | VfsHost mount (VfsFolder folder); |
|---|
| | 68 | VfsHost mount (VfsFolder folder, char[] name=null); |
|---|
| 65 | 69 | |
|---|
| 66 | 70 | /*********************************************************************** |
|---|
Download in other formats:
|
 |
 |
|
 |
Copyright © 2006-2008 Tango. All Rights Reserved. | Page Width:
Static or
Dynamic