Repository navigation
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #133 (item 1: map cache deletes maps on launch).
Problem
syncFilesdeleted the map's files from disk whenever re-parsing a cached map threw. A parse failure isn't proof the map is broken, so this could wipe user maps on launch.FolderPaths could contain mixed separators (MapParser.EncodeusedPath.Combine, giving.../maps\Nameon Windows). On a real cache I checked, 32 of 151 entries had this.addNonCachedFilescompared raw DB paths against normalized disk paths, so those maps never matched..phxmfiles,addNonCachedFilesstored the.phxmpath asFolderPathinstead of the extracted folder. The.phxmis deleted after extraction, so the entry was dropped and rebuilt every launch.Changes
syncFiles: on parse failure, log and remove the entry from the cache only; files on disk are left untouched.syncFiles: normalize existingFolderPaths to forward slashes and save them.addNonCachedFiles: compare normalized paths; keep the folder path returned by the parser.InsertMap: normalize both paths before the compare that guardsDirectory.Delete.MapParser.Encode/MapParser.PHXM: store and look upFolderPathwith forward slashes.Item 2 of #133 (
x.Hash == x.Hash) no longer exists after the cache rework. Item 3 (.txtimport nulls) is left for a separate PR.Testing
Windows, Godot 4.7.2 .NET, on a backed-up user folder with 151 maps:
metadata.jsonand touchedobjects.phxmoso a re-parse is forced. The map was removed from the cache with a log message and its folder stayed on disk (previously the folder was deleted).dotnet csharpier check .anddotnet format --verify-no-changes Rhythia.csprojpass.AI usage
This PR was written with help from Claude (Claude Code): it helped investigate the cache code, write the changes and draft this description. I reviewed and tested the changes myself and can explain and fix them.
🤖 Generated with Claude Code