예제 #1
0
        private MemFSDirectory GetDirectoryForPath(string path)
        {
            string[] elements = path.Split(new Char[] { '/', '\\' });

            MemFSDirectory cwd = root;
            MemFsEntry     e;

            for (int x = 1; x < elements.Length - 1; x++)
            {
                e = cwd.GetEntry(elements[x]);
                if ((e == null) || (!(e is MemFSDirectory)))
                {
                    return(null);
                }
                cwd = (MemFSDirectory)e;
            }

            return(cwd);
        }
예제 #2
0
        private MemFsEntry GetEntryForPath(string path)
        {
            // Seems like a hack, but it's a consequence of the way we store
            // directories. When opening the root, the driver asks for "\\" (
            // note that is one backslash escaped). If we break this up into
            // components we get a directory of "" and a file of "". Opening a
            // directory of "" works, because GetDirectoryForPath returns the
            // root when there are no backslashes to split on. But inside the
            // root there is no file named "". I don't see a better way of
            // handling this, unless we create a "virtual" entry named "" in
            // each directory that points to self? That seems worse, since
            // we don't handle "." or ".." references either.
            if (path.Equals("\\"))
            {
                return(root);
            }
            MemFSDirectory dir = GetDirectoryForPath(path);

            if (dir == null)
            {
                return(null);
            }
            return(dir.GetEntry(GetFilenameFromPath(path)));
        }
예제 #3
0
 public MemFSje()
 {
     root = new MemFSDirectory("");
 }
예제 #4
0
 public MemFSje()
 {
     root = new MemFSDirectory("");
 }