godotengine / godotengine/godot
`ResourceSaver::set_uid` does not check path is recognized
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
Godot 4.7, 4.6, and 4.6.1
### System information
Fedora 42
### Issue description
Methods in both `ResourceSaver` and `ResourceLoader` validate that, when iterating the savers or loaders, respectively, the implementation is called by checking whether it either handles the `Resource` or recognizes the path.
However, `ResourceSaver::set_uid` does not perform these checks and instead delegates this detail to the implementation, which is out of alignment with the other methods. Because this isn't documented, it can lead to errors or editor crashes.
`ResoureSaver::set_uid` should behave like its sibling methods, and validate the path is recognized before calling the saver implementation.
I realize this is currently an API limitation because the `recognize_path` method takes both a resource and path; however, perhaps it would be advantageous to introduce a new API to align the behavior expectations. The `ResourceLoader` implementation has such methods, at least.
### Steps to reproduce
n/a
### Minimal reproduction project (MRP)
n/a
Contributor guide
Research direction
Start with ResourceSaver::set_uid and compare its behavior with the sibling ResourceSaver and ResourceLoader methods described in the issue. Read how recognize_path is used while iterating savers or loaders, including the current API limitation. Done means set_uid validates that the path is recognized before calling the saver implementation, with behavior aligned to the other methods.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100