1// SPDX-FileCopyrightText: 2025 The Project Pterodactyl Developers
2// SPDX-FileCopyrightText: 2026 The Project Pterodactyl Developers
3//
4// SPDX-License-Identifier: MPL-2.0
5
6import TSCBasic
7import llbuild2fx
8
9extension LLBDeclFileTree {
10 static func file(absolutePath: AbsolutePath, contents: String) -> Self {
11 let components = absolutePath.components
12 let leaf = LLBDeclFileTree.file(contents)
13 return components.dropFirst().reversed().reduce(leaf) { tail, name in
14 .directory(files: [name: tail])
15 }
16 }
17}