this repo has no description
www.jonmsterling.com/01HC/
1// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers
2//
3// SPDX-License-Identifier: MPL-2.0
4
5import Foundation
6import TSCBasic
7import llbuild2fx
8
9extension LLBCASFileTree {
10 func traverse(root: AbsolutePath, in db: any LLBCASDatabase, _ ctx: Context, _ callback: (AbsolutePath, LLBDataID, LLBDirectoryEntry) async throws -> Void) async throws {
11 for (index, fileId) in object.refs.enumerated() {
12 let directoryEntry = files[index]
13 switch directoryEntry.type {
14 case .directory:
15 let root = root.appending(component: directoryEntry.name)
16 let subtree = try await Self.load(id: fileId, from: db, ctx).get()
17 try await subtree.traverse(root: root, in: db, ctx, callback)
18 case .plainFile:
19 try await callback(root.appending(component: directoryEntry.name), fileId, directoryEntry)
20 default: continue
21 }
22 }
23 }
24}