fix(project): a module resref names a file, not a resource
ci / ci (pull_request) Successful in 3m50s
ci / ci (pull_request) Successful in 3m50s
module.resref is the name of the built .mod on disk, so the 16-byte resref limit never applied to it — NWN:EE module file names are routinely longer. The blanket check rejected ShadowsOverWestgate (19 characters) and blocked sow-module#60. It is now validated as a file name instead, which still rejects a resref that is a path or an empty string. The limit is kept where the value really does become a resref: a project with paths.assets and no haks[] names its single generated HAK after the module resref, and a HAK name is a resref the engine loads. That case now says what to do about it rather than refusing every long module name. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -560,8 +560,18 @@ func (p *Project) ValidateLayout() error {
|
||||
if strings.TrimSpace(p.Config.Module.ResRef) == "" {
|
||||
failures = append(failures, errors.New("module.resref is required"))
|
||||
}
|
||||
if len(p.Config.Module.ResRef) > 16 {
|
||||
failures = append(failures, fmt.Errorf("module.resref %q exceeds 16 characters", p.Config.Module.ResRef))
|
||||
// module.resref names the built .mod FILE, so the 16-byte resref limit does not
|
||||
// apply to it — NWN:EE module file names are routinely longer. It is validated as
|
||||
// a file name instead. The limit still binds when the same value has to be a real
|
||||
// resref: with no haks configured, an asset project names its single generated HAK
|
||||
// after it, and a HAK name is a resref the engine loads.
|
||||
if err := validateOutputFileName("module.resref", p.Config.Module.ResRef+".mod", ".mod"); err != nil {
|
||||
failures = append(failures, err)
|
||||
}
|
||||
if len(p.Config.Module.ResRef) > 16 && strings.TrimSpace(p.Config.Paths.Assets) != "" && len(p.Config.HAKs) == 0 {
|
||||
failures = append(failures, fmt.Errorf(
|
||||
"module.resref %q exceeds 16 characters and would name this project's generated HAK; configure haks[] with a shorter name",
|
||||
p.Config.Module.ResRef))
|
||||
}
|
||||
if strings.TrimSpace(p.Config.Paths.Source) == "" && strings.TrimSpace(p.Config.Paths.Assets) == "" && !p.HasTopData() {
|
||||
failures = append(failures, errors.New("at least one of paths.source, paths.assets, or topdata.source is required"))
|
||||
|
||||
Reference in New Issue
Block a user