Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Changeset 2837

Show
Ignore:
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
  • trunk/tango/io/vfs/FileFolder.d

    r2818 r2837  
    3535        private FilePath        path; 
    3636        private VfsStats        stats; 
    37         private char[]          name_; 
    3837 
    3938        /*********************************************************************** 
     
    4847        ***********************************************************************/ 
    4948 
    50         this (char[] name, char[] path, bool create=false) 
     49        this (char[] path, bool create=false) 
    5150        { 
    5251                this.path = open (FilePath(path), create); 
    53                 name_ = name; 
    5452        } 
    5553 
     
    8583        final char[] name () 
    8684        { 
    87                 auto name = name_; 
    88                 if (name.ptr is null) 
    89                     name = path.name; 
    90                 return name; 
     85                return path.name; 
    9186        } 
    9287 
  • trunk/tango/io/vfs/LinkedFolder.d

    r2809 r2837  
    7676                we subsequently traverse when looking up a file 
    7777 
     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 
    7882        ***********************************************************************/ 
    7983 
    80         final VfsHost mount (VfsFolder folder
     84        final VfsHost mount (VfsFolder folder, char[] name=null
    8185        { 
    8286                // traverse to the end of the list 
     
    8993 
    9094                // and let superclass deal with it  
    91                 return super.mount (folder); 
     95                return super.mount (folder, name); 
    9296        } 
    9397 
  • trunk/tango/io/vfs/VirtualFolder.d

    r2819 r2837  
    8585                tree of virtual folders are detected and trapped. 
    8686 
    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) 
    9094        { 
    9195                assert (folder); 
     96                if (name.length is 0) 
     97                    name = folder.name; 
    9298 
    9399                // link virtual children to us 
     
    95101                if (child) 
    96102                    if (child.parent) 
    97                         error ("folder '"~folder.name~"' belongs to another host");  
     103                        error ("folder '"~name~"' belongs to another host");  
    98104                    else 
    99105                       child.parent = this; 
     
    103109                while (root.parent) 
    104110                       if (root is this) 
    105                            error ("circular reference detected while mounting '"~folder.name~"'"); 
     111                           error ("circular reference detected at '"~this.name~"' while mounting '"~name~"'"); 
    106112                       else 
    107113                          root = root.parent; 
     
    109115 
    110116                // all clear, so add the new folder 
    111                 mounts [folder.name] = folder; 
     117                mounts [name] = folder; 
    112118                return this; 
    113119        } 
     
    563569        auto root = new VirtualFolder ("root"); 
    564570        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 
    567573        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")); 
    570576 
    571577        auto folder = root.folder (r"temp\bar"); 
  • trunk/tango/io/vfs/model/Vfs.d

    r2819 r2837  
    6060                tree of virtual folders are detected and trapped. 
    6161 
     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 
    6266        **********************************************************************/ 
    6367 
    64         VfsHost mount (VfsFolder folder); 
     68        VfsHost mount (VfsFolder folder, char[] name=null); 
    6569 
    6670        /***********************************************************************