mirror of
https://github.com/godotengine/godot.git
synced 2025-01-12 20:22:49 +08:00
Merge pull request #90949 from rhofour/gdignore
LSP: Have `GDScriptWorkspace::list_script_files` respect `.gdignore`.
This commit is contained in:
commit
c33cd94509
@ -233,18 +233,25 @@ void GDScriptWorkspace::reload_all_workspace_scripts() {
|
|||||||
void GDScriptWorkspace::list_script_files(const String &p_root_dir, List<String> &r_files) {
|
void GDScriptWorkspace::list_script_files(const String &p_root_dir, List<String> &r_files) {
|
||||||
Error err;
|
Error err;
|
||||||
Ref<DirAccess> dir = DirAccess::open(p_root_dir, &err);
|
Ref<DirAccess> dir = DirAccess::open(p_root_dir, &err);
|
||||||
if (OK == err) {
|
if (OK != err) {
|
||||||
dir->list_dir_begin();
|
return;
|
||||||
String file_name = dir->get_next();
|
}
|
||||||
while (file_name.length()) {
|
|
||||||
if (dir->current_is_dir() && file_name != "." && file_name != ".." && file_name != "./") {
|
// Ignore scripts in directories with a .gdignore file.
|
||||||
list_script_files(p_root_dir.path_join(file_name), r_files);
|
if (dir->file_exists(".gdignore")) {
|
||||||
} else if (file_name.ends_with(".gd")) {
|
return;
|
||||||
String script_file = p_root_dir.path_join(file_name);
|
}
|
||||||
r_files.push_back(script_file);
|
|
||||||
}
|
dir->list_dir_begin();
|
||||||
file_name = dir->get_next();
|
String file_name = dir->get_next();
|
||||||
|
while (file_name.length()) {
|
||||||
|
if (dir->current_is_dir() && file_name != "." && file_name != ".." && file_name != "./") {
|
||||||
|
list_script_files(p_root_dir.path_join(file_name), r_files);
|
||||||
|
} else if (file_name.ends_with(".gd")) {
|
||||||
|
String script_file = p_root_dir.path_join(file_name);
|
||||||
|
r_files.push_back(script_file);
|
||||||
}
|
}
|
||||||
|
file_name = dir->get_next();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user