diff options
| author | historia <[not public]> | 2026-09-18 20:11:29 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-09-18 20:11:29 -0400 |
| commit | 0f812ccc307ea0550511ccced40b65dfb0cdaa91 (patch) | |
| tree | 7f2f343985275a478ba7295a37fcd48871ca4956 /internal/behavior/store.go | |
| parent | 79764732406d6484f67d3dec045483dcb5d08c28 (diff) | |
| download | thehouseoficarus-0f812ccc307ea0550511ccced40b65dfb0cdaa91.tar.gz | |
fix: world and casino integrity fixes
Diffstat (limited to 'internal/behavior/store.go')
| -rw-r--r-- | internal/behavior/store.go | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/internal/behavior/store.go b/internal/behavior/store.go index a558f87..4051836 100644 --- a/internal/behavior/store.go +++ b/internal/behavior/store.go @@ -47,12 +47,24 @@ func BuildRoomIndex(dir string) map[int]string { func WalkYAMLDir(dir string, fn func(path, id string, data []byte) error) error { return filepath.WalkDir(dir, func(path string, d os.DirEntry, err error) error { - if err != nil || d.IsDir() || !strings.HasSuffix(d.Name(), ".yaml") { + if err != nil { + // A missing root is an empty tree; any other walk error (for + // example an unreadable directory) must surface instead of + // silently validating nothing. + if os.IsNotExist(err) { + return nil + } + return err + } + if d.IsDir() || !strings.HasSuffix(d.Name(), ".yaml") { return nil } data, readErr := os.ReadFile(path) if readErr != nil { - return nil + if os.IsNotExist(readErr) { + return nil + } + return readErr } id := strings.TrimSuffix(d.Name(), ".yaml") return fn(path, id, data) |
