diff options
Diffstat (limited to 'internal/admin/api_files.go')
| -rw-r--r-- | internal/admin/api_files.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/admin/api_files.go b/internal/admin/api_files.go index 96b5e81..2aa0e5f 100644 --- a/internal/admin/api_files.go +++ b/internal/admin/api_files.go @@ -108,6 +108,22 @@ func (s *AdminServer) handleFileRename(w http.ResponseWriter, r *http.Request) { return } + // A raw rename changes the ID-bearing filename. Rebuild the room index + // and drop the old room's cached state (mirroring the DELETE path), and + // refresh item/mob/drop caches, or the old ID resolves to a deleted file + // and the new one resolves to nothing until a restart. + s.evictDeletedRoomFile(relPath) + s.invalidateEntityCacheForPath(newAbs) + // Hazards and courses have their own runtime caches that a raw rename + // must refresh (the undo path does the same). Techs and triggers keep the + // documented in-game `reload` requirement. + if pathUnderDir(s.dataDir, "hazards", newAbs) { + s.world.ClearHazardCache() + } + if pathUnderDir(s.dataDir, "courses", newAbs) { + s.reloadCoursesIfWired() + } + newRelPath := filepath.Join(filepath.Dir(relPath), newName) if filepath.Dir(relPath) == "." { newRelPath = newName |
