func grabFilenames()

in Sources/TSFCASFileTree/Internal/ConcurrentFilesystemScanner.swift [172:199]


            func grabFilenames(from dir: FilesystemDirectoryIterator) -> Bool {
                guard let (entries, hasMoreEntries) = dir.next() else {
                    return false
                }

                var moreDirectories = [FilesystemPathInfo]()
                for entry in entries {
                    guard let pathInfo = try? FilesystemPathInfo(dir.path.appending(component: entry.name), hint: entry.type) else {
                        continue
                    }
                    guard filter(pathInfo) else {
                        continue
                    }
                    switch pathInfo.info {
                    case .directory:
                        moreDirectories.append(pathInfo)
                    case .file, .symlink, .nonRegular:
                        stashed.append(pathInfo)
                    }
                }

                scanner.sharedLock.lock()
                for dirInfo in moreDirectories {
                    scanner.unprocessed.append(dirInfo)
                }
                scanner.sharedLock.unlock(withValue: 0)
                return hasMoreEntries
            }