/// <summary> /// Gets the <see cref="FileSystemEntryType"/> for a path based on whether the path is directory-indicated. /// Based only on whether the path is directory-indicated, determine the <see cref="FileSystemEntryType"/>. /// Paths do not need to actually exist, this operates at the string-level of abstraction. /// </summary> public static FileSystemEntryType GetFileSystemEntryTypeForPath(this IStringlyTypedPathOperator stringlyTypedPathOperator, string path) { var isDirectory = stringlyTypedPathOperator.IsDirectoryIndicatedPath(path); var entryType = FileSystemEntryTypeHelper.IsDirectoryToFileSystemEntryType(isDirectory); return(entryType); }
public static FileSystemSite EnsureSiteDirectoryPathIsDirectoryIndicated(this FileSystemSite site, IStringlyTypedPathOperator stringlyTypedPathOperator) { var directoryPathIsDirectoryIndicated = stringlyTypedPathOperator.IsDirectoryIndicatedPath(site.DirectoryPath); if (directoryPathIsDirectoryIndicated) { return(site); } else { var directoryIndicatedDirectoryPath = stringlyTypedPathOperator.EnsureDirectoryPathIsDirectoryIndicated(site.DirectoryPath); var output = new FileSystemSite(directoryIndicatedDirectoryPath, site.FileSystemOperator); return(output); } }