You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to open the same script multiple times in the script editor. This results in a reappearing "The file on disk is newer"-warning until the duplicate scripts are closed.
(identical file names except upper and lower case. Windows does not really separate between upper and lower case)
I think there needs to be a check earlier on if the file paths are identical (when converted to lower case). If only the case is different one option is to flat out ignore the rename (because of Windows and like Windows does). The - I imagine - safest other option would be to rename the path automatically first to an intermediate path, also to make sure that Windows renames folders correctly.
The following code in dir_access_windows.cpp seems relevant:
// If we're only changing file name case we need to do a little juggling
if (p_path.to_lower() == p_new_path.to_lower()) {
if (dir_exists(p_path)) {
// The path is a dir; just rename <== (me: there probably needs to happen some juggling here)
return ::_wrename((LPCWSTR)(p_path.utf16().get_data()), (LPCWSTR)(p_new_path.utf16().get_data())) == 0 ? OK : FAILED;
}
// The path is a file; juggle
WCHAR tmpfile[MAX_PATH];
I also think there needs to be an OS independent check earlier. IMHO it should not be possible on any OS to have file paths that differ only in case in order to enforce portability.
Steps to reproduce
The first three steps have already been done in minimal reproduction project.
(
create "X/X.tscn" and "X/X.gd"
apply X.gd to the root of X.tscn and save
open the script
)
Rename the folder "X" to "x", this will result in an error but temporarily create the folder.
You should now have "x/X.gd" and "X/X.gd" open inside the script editor.
Minimal reproduction project
RenameBug.zip
Renaming the folder "X" to "x" should be enough to trigger the bug. This only seems to work the first time and is probably a Windows specific bug.
The text was updated successfully, but these errors were encountered:
Came across this issue while fixing #76021
It also affects Scenes:
I was able to reproduce it just by renaming folders in the OS (Windows) file manager. My bug fix stops folder duplication, but not having the same file opened multiple times.
Godot version
4.0 Beta3
System information
Windows 10
Issue description
It is possible to open the same script multiple times in the script editor. This results in a reappearing "The file on disk is newer"-warning until the duplicate scripts are closed.
(identical file names except upper and lower case. Windows does not really separate between upper and lower case)
I think there needs to be a check earlier on if the file paths are identical (when converted to lower case). If only the case is different one option is to flat out ignore the rename (because of Windows and like Windows does). The - I imagine - safest other option would be to rename the path automatically first to an intermediate path, also to make sure that Windows renames folders correctly.
The following code in dir_access_windows.cpp seems relevant:
I also think there needs to be an OS independent check earlier. IMHO it should not be possible on any OS to have file paths that differ only in case in order to enforce portability.
Steps to reproduce
The first three steps have already been done in minimal reproduction project.
(
create "X/X.tscn" and "X/X.gd"
apply X.gd to the root of X.tscn and save
open the script
)
Rename the folder "X" to "x", this will result in an error but temporarily create the folder.
You should now have "x/X.gd" and "X/X.gd" open inside the script editor.
Minimal reproduction project
RenameBug.zip
Renaming the folder "X" to "x" should be enough to trigger the bug. This only seems to work the first time and is probably a Windows specific bug.
The text was updated successfully, but these errors were encountered: