godotengine / godot

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

Renaming a file updates it in the editor but doesn't rename it on the disk if its only the letter cases #94340

Open ydeltastar opened 2 months ago

ydeltastar commented 2 months ago

Tested versions

v4.3.beta.custom_build [97b8ad1af]

System information

Windows 11

Issue description

If I change only the cases in the name of file using the editor's filesystem dock, the name updates in the interface but the file isn't renamed on the disk.

There is also a cache issue going on because reloading the editor doesn't show the current filename on the disk as well.

Steps to reproduce

Minimal reproduction project (MRP)

N/A

ydeltastar commented 2 months ago

The issue doesn't happen when I place a breakpoint somewhere here like ReplaceFileW or _wrename while debugging. https://github.com/godotengine/godot/blob/97b8ad1af0f2b4a216f6f1263bef4fbc69e56c7b/drivers/windows/dir_access_windows.cpp#L286-L298 But it always happens if it runs normally. No clue why since nothing returns errors... Maybe file locking or threading issues? I have a very fast SSD NVMe so it's possible that debug breaking gives it time for the issue to untangle but running normally doesn't.

AThousandShips commented 2 months ago

This is because of case sensitive file systems, or rather lack of them, this is an operating system limitation, don't know how to approach it from the editor side

4X3L82 commented 2 months ago

This is because of case sensitive file systems, or rather lack of them, this is an operating system limitation, don't know how to approach it from the editor side

Yes, this is more on Windows than Godot. I just tested this on Linux: I renamed a file with just case changes in the editor, and the changes are reflected on disk.

AThousandShips commented 2 months ago

I can't replicate this myself, for me it fixes the name correctly on disk, unsure what might not be working for you, I'm on Windows 11

LikiaBili commented 2 months ago

I can't replicate this myself, for me it fixes the name correctly on disk, unsure what might not be working for you, I'm on Windows 11

So the solution is to either the user updates windows or adding a compactable solution like deleting the original file and then creating a new file automatically to achieve the same result? I'm not able to replicate this on Windows 10 Godot 4.2 .NET

AThousandShips commented 2 months ago

This works fine on my Windows 11, the original report is also Windows 11 so this isn't a matter of Windows 10 Vs 11, can you replicate this on windows 11?

ydeltastar commented 2 months ago

I can't replicate this myself, for me it fixes the name correctly on disk, unsure what might not be working for you, I'm on Windows 11

That's the weird thing. I can reproduce 100% of the time on any project but I remember it never being a problem before since version 3. It started recently but now it happens in 4.2 too.

I tried using the same Windows API on a minimal C++ test to rename the same file and it works.

DylanCheetah commented 2 months ago

I am unable to reproduce this bug on Windows 11. I suspect that it was related to Windows itself. I do recall that for a while renaming a file in the File Explorer had the exact same bug as well. However, it appears to be fixed.