Directory GetRootDirectory(PathName name) { string root = Path.GetPathRoot(name.GetAbsolutePath()); var di = new DirectoryInfo(root); return new DotNetDirectory(DirectoryName.GetDirectoryName(di.FullName)); }
public override PathName Combine(PathName child) { if (child is AbsolutePathName) throw new InvalidOperationException("Cannot combine an absolute path with a zip path"); if (child is ZipPathName) throw new IOException("Cannot combine a zip file path with a zip file path"); return new ZipPathName(_zipFilePath, Path.Combine(_contentFilePath, child.GetPath())); }
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); }
Directory ResolveDirectory(PathName name) { Directory rootDirectory = GetRootDirectory(name); string relativePath = name.GetAbsolutePath().Substring(rootDirectory.Name.GetPath().Length); string[] names = relativePath.Split('\\', '/'); return ResolveDirectory(rootDirectory, names); }
public abstract DirectoryName Combine(PathName child);
public static DirectoryName GetDirectoryName(PathName pathName) { return GetDirectoryName(pathName.GetPath()); }
public override DirectoryName Combine(PathName child) { return base.Combine(child); }
public abstract PathName Combine(PathName child);