Directory GetRootDirectory(PathName name) { string root = Path.GetPathRoot(name.GetAbsolutePath()); var di = new DirectoryInfo(root); return new DotNetDirectory(DirectoryName.GetDirectoryName(di.FullName)); }
public static FileName GetFileName(PathName pathName) { if (pathName is RelativePathName) return new RelativeFileName(((RelativePathName)pathName)); if (pathName is AbsolutePathName) return new AbsoluteFileName(((AbsolutePathName)pathName)); throw new InvalidOperationException("Unable to convert path: " + pathName); }
File ResolveFile(PathName name) { Directory rootDirectory = GetRootDirectory(name); string relativePath = name.GetAbsolutePath().Substring(rootDirectory.Name.GetPath().Length); string[] names = relativePath.Split('\\', '/'); return ResolveFile(rootDirectory, names); }
public abstract PathName Combine(PathName child);
public abstract DirectoryName Combine(PathName child);
public static DirectoryName GetDirectoryName(PathName pathName) { return GetDirectoryName(pathName.GetPath()); }