Open lyuma opened 3 years ago
I can confirm the bug, I just created a 3d scene with some tool scripts, and opening them again the following error message is thrown:
scene/resources/resource_format_text.cpp:555 - res://Scene.tscn:12 - Parse Error: Expected float in constructor
Failed loading resource: res://Scene.tscn. Make sure resources have been imported by opening the project in the editor at least once.
editor/editor_data.cpp:539 - Index p_idx = 1 is out of bounds (edited_scene.size() = 1).
FileAccess already has a safe backup mechanism: https://github.com/godotengine/godot/blob/8cd1b59ea78f5145eae1762e2b1311c1a1b92cbc/editor/editor_node.cpp#L5689
Example on UNIX: https://github.com/godotengine/godot/blob/8cd1b59ea78f5145eae1762e2b1311c1a1b92cbc/drivers/unix/file_access_unix.cpp#L113-L117
Example on Windows: https://github.com/godotengine/godot/blob/8cd1b59ea78f5145eae1762e2b1311c1a1b92cbc/drivers/windows/file_access_windows.cpp#L111-L114
Godot version: 4.0.dev d1dc28e
OS/device including version: Windows 10.0.19041.928
Issue description: If the user hits ctrl-c or kills Godot while it is writing a resource, that resource is corrupted.
The case I'm running into is from killing godot while it's still loading the project list.
It is never acceptable for a crash to cause resource corruption. It should either save the old resource state, or the new state, not corrupt the resource.
Steps to reproduce:
Minimal reproduction project: occurs during project selector window.