public VirtualDirectory(string path) { FullName = path != null?IOUtility.GetSafeDirectoryPath(path).TrimEnd(IOUtility.PathSeparator) : String.Empty; var parents = FullName.Split(new[] { IOUtility.PathSeparator }, StringSplitOptions.RemoveEmptyEntries); if (parents.Length == 0) { Name = FullName; return; } Name = parents.LastOrDefault() ?? FullName; if (parents.Length > 1) { Parent = new VirtualDirectory(String.Join("/", parents.Take(parents.Length - 1))); } }
public virtual bool Equals(string other) { return(Insensitive.Equals( FullName, other != null ? IOUtility.GetSafeDirectoryPath(other).TrimEnd(IOUtility.PathSeparator) : String.Empty)); }