You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-07 12:30:27 +00:00
Avoid recursion in filesystem scanning, closes #3838
This commit is contained in:
@@ -621,10 +621,18 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
|
|||||||
int total = dirs.size()+files.size();
|
int total = dirs.size()+files.size();
|
||||||
int idx=0;
|
int idx=0;
|
||||||
|
|
||||||
|
|
||||||
for (List<String>::Element *E=dirs.front();E;E=E->next(),idx++) {
|
for (List<String>::Element *E=dirs.front();E;E=E->next(),idx++) {
|
||||||
|
|
||||||
if (da->change_dir(E->get())==OK) {
|
if (da->change_dir(E->get())==OK) {
|
||||||
|
|
||||||
|
String d = da->get_current_dir();
|
||||||
|
|
||||||
|
if (d==cd || !d.begins_with(cd)) {
|
||||||
|
da->change_dir(cd); //avoid recursion
|
||||||
|
} else {
|
||||||
|
|
||||||
|
|
||||||
EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory );
|
EditorFileSystemDirectory *efd = memnew( EditorFileSystemDirectory );
|
||||||
|
|
||||||
efd->parent=p_dir;
|
efd->parent=p_dir;
|
||||||
@@ -646,6 +654,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir,DirAccess
|
|||||||
}
|
}
|
||||||
|
|
||||||
da->change_dir("..");
|
da->change_dir("..");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ERR_PRINTS(TTR("Cannot go into subdir:")+" "+E->get());
|
ERR_PRINTS(TTR("Cannot go into subdir:")+" "+E->get());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user