public IList <DirectoryEntry> GetDirectoryEntries(FullPath path) { var list = NativeFile.GetDirectoryEntries(path.Value); // Skip any entry that is longer than MAX_PATH. // Fix this once we fully support the long path syntax ("\\?\" prefix) if (list.Any(entry => PathHelpers.IsPathTooLong(path.Value, entry.Name))) { return(list.Where(entry => { if (PathHelpers.IsPathTooLong(path.Value, entry.Name)) { // Note: The condition is unsafe from a pure concurrency point of view, // but is ok in this case because the field is incrementally increasing. // This is just an optimization to avoid an Interlocked call. if (_pathTooLongErrorCount <= MaxPathTooLogLogCount) { var logCount = Interlocked.Increment(ref _pathTooLongErrorCount); if (logCount <= MaxPathTooLogLogCount) { Logger.LogInfo("Skipping directory entry because path is too long: \"{0}\"", path.Combine(new RelativePath(entry.Name))); } if (logCount == MaxPathTooLogLogCount) { Logger.LogInfo(" (Note: No more message abount path too long will be logged, because the maximum number of occurrences has been reached)"); } } return false; } return true; }).ToList()); } return(list); }
public static bool IsChromiumSourceDirectory(FullPathName path, IPathPatternsFile chromiumEnlistmentPatterns) { // We need to ensure that all pattern lines are covered by at least one file/directory of |path|. IList <string> directories; IList <string> files; NativeFile.GetDirectoryEntries(path.FullName, out directories, out files); return(chromiumEnlistmentPatterns.GetPathMatcherLines() .All(item => MatchFileOrDirectory(item, directories, files))); }
public IList <DirectoryEntry> GetDirectoryEntries(FullPath path) { return(NativeFile.GetDirectoryEntries(path.Value)); }
public static void GetFileSystemEntries(FullPathName rootPath, RelativePathName path, out IList<string> directories, out IList<string> files) { NativeFile.GetDirectoryEntries(PathHelpers.PathCombine(rootPath.FullName, path.RelativeName), out directories, out files); }