mirror of
https://github.com/godotengine/godot
synced 2024-09-05 05:38:35 +00:00
Stop the searching of find in files
in folders that have .gdignore
This commit is contained in:
parent
b94eb58d35
commit
b062f5b6fa
|
@ -172,9 +172,11 @@ void FindInFiles::_iterate() {
|
|||
_current_dir = _current_dir.path_join(folder_name);
|
||||
|
||||
PackedStringArray sub_dirs;
|
||||
_scan_dir("res://" + _current_dir, sub_dirs);
|
||||
PackedStringArray files_to_scan;
|
||||
_scan_dir("res://" + _current_dir, sub_dirs, files_to_scan);
|
||||
|
||||
_folders_stack.push_back(sub_dirs);
|
||||
_files_to_scan.append_array(files_to_scan);
|
||||
|
||||
} else {
|
||||
// Go back one level.
|
||||
|
@ -211,7 +213,7 @@ float FindInFiles::get_progress() const {
|
|||
return 0;
|
||||
}
|
||||
|
||||
void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
|
||||
void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan) {
|
||||
Ref<DirAccess> dir = DirAccess::open(path);
|
||||
if (dir.is_null()) {
|
||||
print_verbose("Cannot open directory! " + path);
|
||||
|
@ -227,8 +229,11 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
|
|||
break;
|
||||
}
|
||||
|
||||
// If there is a .gdignore file in the directory, skip searching the directory.
|
||||
// If there is a .gdignore file in the directory, clear all the files/folders
|
||||
// to be searched on this path and skip searching the directory.
|
||||
if (file == ".gdignore") {
|
||||
out_folders.clear();
|
||||
out_files_to_scan.clear();
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -247,7 +252,7 @@ void FindInFiles::_scan_dir(String path, PackedStringArray &out_folders) {
|
|||
} else {
|
||||
String file_ext = file.get_extension();
|
||||
if (_extension_filter.has(file_ext)) {
|
||||
_files_to_scan.push_back(path.path_join(file));
|
||||
out_files_to_scan.push_back(path.path_join(file));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ protected:
|
|||
private:
|
||||
void _process();
|
||||
void _iterate();
|
||||
void _scan_dir(String path, PackedStringArray &out_folders);
|
||||
void _scan_dir(String path, PackedStringArray &out_folders, PackedStringArray &out_files_to_scan);
|
||||
void _scan_file(String fpath);
|
||||
|
||||
// Config
|
||||
|
|
Loading…
Reference in a new issue