public static Resolve ( |
||
vfs | ||
path | String | |
리턴 |
public static INodeDirectory Resolve(VFSCore vfs, String path)
{
INodeDirectory root = Load(vfs, 0);
var pathCom = path.Split('/');
var node = root;
for (var i = 1; i < pathCom.Length - 1; ++i)
{
if (node.Contains(pathCom[i]) && INode.Load(vfs, node.Find(pathCom[i])).IsDirectory())
{
node = Load(vfs, node.Find(pathCom[i]));
}
else
{
return null;
}
}
return node;
}
public Directory(VFSCore vfs, String path) { this.vfs = vfs; if (!path.EndsWith("/")) { path += "/"; } this.path = path; dir = INodeDirectory.Resolve(vfs, path); if (dir == null) { throw new Exception("无效路径"); } }