godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
89.21k stars 20.22k forks source link

Moving file referenced in resources generates .depren files #96687

Open 4X3L82 opened 2 weeks ago

4X3L82 commented 2 weeks ago

Tested versions

Reproducible in:

The message from 4.2.1: image

4.3 & 4.4 are silent.

System information

Godot v4.4.dev1 - Manjaro Linux #1 SMP PREEMPT_DYNAMIC Mon Aug 19 09:51:26 UTC 2024 - X11 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3080 Laptop GPU - AMD Ryzen 9 5900HX with Radeon Graphics (16 Threads)

Issue description

When moving files around that are part of a resource, Godot creates an extra .depren file. Deleting this file doesn't seem to do/break anything? I think if this is part of some internal process for moving files, that it didn't clean up after itself.

It seems that this bug is back?

Steps to reproduce

Deleting this file seems to have no effect on the project.

Minimal reproduction project (MRP)

Open this project in Godot: depren.zip

In the editor, select the icon.svg and drag it into the asset directory. Open your file explorer and the root of the project now has an extra file: icon.res.depren

DHNebula commented 2 weeks ago

I've been able to reproduce the issue on my end, and the issue seems to be in resource_format_binary.cpp. It's reaching this section of ResourceFormatLoaderBinary::rename_dependencies in the debugger:

if (da->exists(p_path + ".depren")) {
    da->remove(p_path);
    da->rename(p_path + ".depren", p_path);
}

I've not been able to figure out why, but the first line of the if is returning false even though the file exists, meaning it never gets around to cleaning up the files.