fix(pipeline): make the full module build work for module-only projects (#17)
`crucible module build` runs the full pipeline (module + HAK producer +
topdata). A module-only project consumes prebuilt HAKs and has no
`paths.assets`, so the HAK stage crashed on the unset assets dir: the
music-credits walk hit `filepath.WalkDir("")` (`lstat : no such file or
directory`) and asset collection hit `filepath.Rel(root, "")`.
Guard both on an unset `AssetsDir()`: an absent assets tree simply means
no authored credits and no asset files to collect, so the HAK stage
no-ops cleanly while topdata generated-2DA assets still build. Honors
spec Decision 3 (canonical `crucible module build`, no `build-module`).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Reviewed-on: #17
Co-authored-by: vickydotbat <vickydotbat@tutamail.com>
Co-committed-by: vickydotbat <vickydotbat@tutamail.com>
This commit was merged in pull request #17.
This commit is contained in:
@@ -661,11 +661,17 @@ func collectAssetResources(p *project.Project, requireContent bool, allowed map[
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
assetsRelPath, err := filepath.Rel(p.Root, p.AssetsDir())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve assets dir relative path: %w", err)
|
||||
// A module-only project (consumes prebuilt HAKs, has no paths.assets) has no
|
||||
// asset files to collect — AssetFiles is empty and AssetsDir() is "". Skip the
|
||||
// relative-path resolve, which would otherwise fail with `Rel: can't make ""`.
|
||||
assetsRelPath := ""
|
||||
if p.AssetsDir() != "" {
|
||||
assetsRelPath, err = filepath.Rel(p.Root, p.AssetsDir())
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("resolve assets dir relative path: %w", err)
|
||||
}
|
||||
assetsRelPath = filepath.ToSlash(assetsRelPath)
|
||||
}
|
||||
assetsRelPath = filepath.ToSlash(assetsRelPath)
|
||||
|
||||
for _, rel := range p.Inventory.AssetFiles {
|
||||
if musicAssets != nil {
|
||||
|
||||
Reference in New Issue
Block a user