Skip to content

Commit 87b5a56

Browse files
committed
Fix duplicated folder reference in Godot Editor after changing filename case
1 parent 655e93d commit 87b5a56

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

editor/editor_file_system.cpp

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1367,6 +1367,10 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
13671367

13681368
String f = ProjectSettings::get_singleton()->localize_path(p_file);
13691369

1370+
// Note: Only checks if base directory is case sensitive.
1371+
Ref<DirAccess> dir = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
1372+
bool fs_case_sensitive = dir->is_case_sensitive("res://");
1373+
13701374
if (!f.begins_with("res://")) {
13711375
return false;
13721376
}
@@ -1390,9 +1394,16 @@ bool EditorFileSystem::_find_file(const String &p_file, EditorFileSystemDirector
13901394

13911395
int idx = -1;
13921396
for (int j = 0; j < fs->get_subdir_count(); j++) {
1393-
if (fs->get_subdir(j)->get_name() == path[i]) {
1394-
idx = j;
1395-
break;
1397+
if (fs_case_sensitive) {
1398+
if (fs->get_subdir(j)->get_name() == path[i]) {
1399+
idx = j;
1400+
break;
1401+
}
1402+
} else {
1403+
if (fs->get_subdir(j)->get_name().to_lower() == path[i].to_lower()) {
1404+
idx = j;
1405+
break;
1406+
}
13961407
}
13971408
}
13981409

0 commit comments

Comments
 (0)