public IFile GetFile(FilePath path) { if (path == null) { throw new ArgumentNullException(nameof(path)); } if (!path.IsRelative) { throw new ArgumentException("Path must be relative", nameof(path)); } return(_fileSystem.GetInputFile(_path.CombineFile(path))); }
public void ReturnsInputFileWhenInputDirectoryAndFileAscend() { // Given FileSystem fileSystem = new FileSystem(); fileSystem.RootPath = "/a/b"; fileSystem.InputPaths.Add("../x/y"); fileSystem.FileProviders.Add(NormalizedPath.DefaultFileProvider.Scheme, GetFileProvider()); // When IFile result = fileSystem.GetInputFile("../bar.txt"); // Then Assert.AreEqual("/a/x/bar.txt", result.Path.FullPath); }
public void ReturnsInputFile(string input, string expected) { // Given FileSystem fileSystem = new FileSystem(); fileSystem.RootPath = "/a"; fileSystem.InputPaths.Add("b/c"); fileSystem.InputPaths.Add("b/d"); fileSystem.InputPaths.Add("x"); fileSystem.InputPaths.Add("y"); fileSystem.FileProviders.Add(NormalizedPath.DefaultFileProvider.Scheme, GetFileProvider()); // When IFile result = fileSystem.GetInputFile(input); // Then Assert.AreEqual(expected, result.Path.FullPath); }
public IFile GetFile(FilePath path) { return(_fileSystem.GetInputFile(_path.CombineFile(path))); }