/// <summary> /// Converts the specified absolute path into a relative path (relative to <c>this</c>). /// </summary> public FileName GetRelativePath(FileName path) { if (path == null) { return(null); } return(FileName.Create(DirectoryName.GetRelativePath(normalizedPath, path))); }
////[Obsolete("The input already is a DirectoryName")] ////public static DirectoryName Create(DirectoryName directoryName) ////{ //// return directoryName; ////} /// <summary> /// Combines this directory name with a relative path. /// </summary> public DirectoryName Combine(DirectoryName relativePath) { if (relativePath == null) { return(null); } return(DirectoryName.Create(Path.Combine(normalizedPath, relativePath))); }
/// <summary> /// Combines this directory name with a relative path. /// </summary> public DirectoryName CombineDirectory(string relativeDirectoryName) { if (relativeDirectoryName == null) { return(null); } return(DirectoryName.Create(Path.Combine(normalizedPath, relativeDirectoryName))); }
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value) { if (value is string) { return(DirectoryName.Create((string)value)); } return(base.ConvertFrom(context, culture, value)); }
/// <summary> /// Gets the directory name. /// </summary> /// <remarks> /// Corresponds to <c>System.IO.Path.GetDirectoryName</c> /// </remarks> public DirectoryName GetParentDirectory() { if (NormalizedPath.Length < 2 || NormalizedPath[1] != ':') { return(DirectoryName.Create(Path.Combine(NormalizedPath, ".."))); } return(DirectoryName.Create(Path.GetDirectoryName(NormalizedPath))); }
public bool Equals(DirectoryName other) { if (other != null) { return(string.Equals(NormalizedPath, other.NormalizedPath, StringComparison.OrdinalIgnoreCase)); } return(false); }
/// <summary> /// Converts the specified absolute path into a relative path (relative to <c>this</c>). /// </summary> public DirectoryName GetRelativePath(DirectoryName path) { if (path == null) { return(null); } return(Create(GetRelativePath(NormalizedPath, path))); }