/// <summary> /// Gets a <see cref="IDirectoryInfo" /> from environment. /// </summary> /// <returns></returns> public IDirectoryInfo Get() { var configurationRoot = _environment.GetEnvironmentVariable(_environmentVariableKey); if (string.IsNullOrEmpty(configurationRoot)) { return(_factory.Build(_directoryFileSystem.GetCurrentDirectory())); } return(_factory.Build(configurationRoot)); }
/// <summary> /// Initializes a new instance of the <see cref="T:IFileSystemInfo" /> implementation, which acts as a wrapper for a /// file path. /// </summary> /// <param name="fileName"> /// The fully qualified name of the new file or directory, or the relative file name or directory name. Do not end the /// path with /// the directory separator character. /// </param> /// <returns></returns> public IFileSystemInfo Build(string fileName) { var fileInfo = _fileInfoFactory.Build(fileName); if (fileInfo.Exists) { return(fileInfo); } return(_directoryInfoFactory.Build(fileName)); }
/// <summary> /// Gets this instance. /// </summary> /// <returns></returns> public IDirectoryInfo Get() { return(_factory.Build(_directoryFileSystem.GetCurrentDirectory())); }