Directory GetRootDirectory(PathName name) { string root = Path.GetPathRoot(name.GetAbsolutePath()); var di = new DirectoryInfo(root); return(new DotNetDirectory(DirectoryName.GetDirectoryName(di.FullName))); }
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 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 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); }
public static DirectoryName GetDirectoryName(string name) { PathName directoryName = PathName.GetPathName(name); if (directoryName is RelativePathName) { return(new RelativeDirectoryName(((RelativePathName)directoryName))); } if (directoryName is AbsolutePathName) { return(new AbsoluteDirectoryName(((AbsolutePathName)directoryName))); } throw new InvalidOperationException("Unable to convert path: " + name); }
public static DirectoryName GetDirectoryName(PathName pathName) { return(GetDirectoryName(pathName.GetPath())); }
public abstract DirectoryName Combine(PathName child);
public static FileName GetFileName(string name) { return(GetFileName(PathName.GetPathName(name))); }
public static DirectoryName GetDirectoryName(PathName pathName) { return GetDirectoryName(pathName.GetPath()); }
public abstract PathName Combine(PathName child);
Directory GetRootDirectory(PathName name) { string root = Path.GetPathRoot(name.GetAbsolutePath()); var di = new DirectoryInfo(root); return new DotNetDirectory(DirectoryName.GetDirectoryName(di.FullName)); }