public static EtoDirectoryInfo GetDirectory(string path) { if (!Path.IsPathRooted(path)) { path = Path.GetFullPath(path); } var pathRoot = Path.GetPathRoot(path); path = path.Substring(pathRoot.Length); string[] paths = path.Split(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); EtoDirectoryInfo di = new DiskDirectoryInfo(pathRoot); foreach (string dir in paths) { di = di.GetSubDirectory(dir); if (di == null) { break; } } return(di); }
public EtoDriveInfo(DriveInfo drive) { this.drive = drive; this.directory = new DiskDirectoryInfo(drive.RootDirectory); }