diff options
author | Fredia Huya-Kouadio <fhuyakou@gmail.com> | 2021-02-21 21:34:27 -0800 |
---|---|---|
committer | Fredia Huya-Kouadio <fhuyakou@gmail.com> | 2021-02-24 18:40:36 -0800 |
commit | eda18fcc1fda6cb33946521e8a677c07a4f216f0 (patch) | |
tree | f4325fd3db42665e3c1fd71735464d678a9ae385 /editor/editor_file_system.cpp | |
parent | 757c151219cccc197cb5ff80dbbdf3e4a9b46e0d (diff) | |
download | redot-engine-eda18fcc1fda6cb33946521e8a677c07a4f216f0.tar.gz |
Update the filtering logic to properly handle directories with `.gdignore` files.
Diffstat (limited to 'editor/editor_file_system.cpp')
-rw-r--r-- | editor/editor_file_system.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 3c6649a66a..dce022e86e 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -669,10 +669,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess continue; } - if (FileAccess::exists(cd.plus_file(f).plus_file("project.godot"))) { // skip if another project inside this - continue; - } - if (FileAccess::exists(cd.plus_file(f).plus_file(".gdignore"))) { // skip if another project inside this + if (_should_skip_directory(cd.plus_file(f))) { continue; } @@ -874,10 +871,7 @@ void EditorFileSystem::_scan_fs_changes(EditorFileSystemDirectory *p_dir, const int idx = p_dir->find_dir_index(f); if (idx == -1) { - if (FileAccess::exists(cd.plus_file(f).plus_file("project.godot"))) { // skip if another project inside this - continue; - } - if (FileAccess::exists(cd.plus_file(f).plus_file(".gdignore"))) { // skip if another project inside this + if (_should_skip_directory(cd.plus_file(f))) { continue; } @@ -1979,6 +1973,20 @@ Error EditorFileSystem::_resource_import(const String &p_path) { return OK; } +bool EditorFileSystem::_should_skip_directory(const String &p_path) { + if (FileAccess::exists(p_path.plus_file("project.godot"))) { + // skip if another project inside this + return true; + } + + if (FileAccess::exists(p_path.plus_file(".gdignore"))) { + // skip if a `.gdignore` file is inside this + return true; + } + + return false; +} + bool EditorFileSystem::is_group_file(const String &p_path) const { return group_file_cache.has(p_path); } |