public DirectorySnapshot FindRootDirectory(FullPath rootPath) { var index = SortedArrayHelpers.BinarySearch(_snapshot.ProjectRoots, rootPath, ProjectRootComparer); if (index >= 0) { return(_snapshot.ProjectRoots[index].Directory); } return(null); }
public FileName CreateFileName(DirectoryName parent, string name) { var directory = FindDirectory(parent); if (directory != null) { // Note: We found the corresponding parent, we just need to check the "simple" name part of the relative name. int index = SortedArrayHelpers.BinarySearch(directory.ChildFiles, name, FileComparer); if (index >= 0) { return(directory.ChildFiles[index]); } } return(_previous.CreateFileName(parent, name)); }
private DirectorySnapshot FindDirectory(DirectoryName name) { if (name.IsAbsoluteName) { return(FindRootDirectory(name.FullPath)); } var parent = FindDirectory(name.Parent); if (parent == null) { return(null); } // Note: We found the corresponding parent, we just need to check the "simple" name part of the relative name. var index = SortedArrayHelpers.BinarySearch(parent.ChildDirectories, name, DirectoryNameComparer); if (index < 0) { return(null); } return(parent.ChildDirectories[index]); }