public static Dir ToDir(this VirtualDir dir) { if (dir == null) { throw new IOException("does not exist"); } var path = dir.GetPath(); var fs = dir.Files.Select(x => Path.Combine(path, x.Key)); var ds = dir.Directories.Select(x => Path.Combine(path, x.Key)); return(Dir.Create(path, ds, fs)); }
internal string GetPath() { if (Parent != null) { if (Parent.Parent == null) { return(Name + Path.DirectorySeparatorChar); } return(Path.Combine(Parent.GetPath(), Name)); } return(""); }