From 48108444f19031ff17f4aa5fde783bc1b98a79c4 Mon Sep 17 00:00:00 2001 From: Fredia Huya-Kouadio Date: Sun, 21 Feb 2021 21:34:27 -0800 Subject: [PATCH] Update the filtering logic to properly handle directories with `.gdignore` files. --- editor/editor_export.cpp | 4 ++++ editor/editor_file_system.cpp | 18 ++++++++++++------ editor/editor_file_system.h | 2 ++ platform/android/export/export.cpp | 3 +++ 4 files changed, 21 insertions(+), 6 deletions(-) diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 612363b7c79..200b1055d1d 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -471,6 +471,10 @@ void EditorExportPlatform::_edit_files_with_filter(DirAccess *da, const Vectorchange_dir(dir); _edit_files_with_filter(da, p_filters, r_list, exclude); da->change_dir(".."); diff --git a/editor/editor_file_system.cpp b/editor/editor_file_system.cpp index 2c037594ebd..5b1729ee172 100644 --- a/editor/editor_file_system.cpp +++ b/editor/editor_file_system.cpp @@ -684,9 +684,7 @@ void EditorFileSystem::_scan_new_dir(EditorFileSystemDirectory *p_dir, DirAccess if (f.begins_with(".")) // Ignore special and . / .. 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; dirs.push_back(f); @@ -886,9 +884,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; EditorFileSystemDirectory *efd = memnew(EditorFileSystemDirectory); @@ -2024,6 +2020,16 @@ 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); } diff --git a/editor/editor_file_system.h b/editor/editor_file_system.h index d768b919c64..ea9fa0652d9 100644 --- a/editor/editor_file_system.h +++ b/editor/editor_file_system.h @@ -275,6 +275,8 @@ public: bool is_group_file(const String &p_path) const; void move_group_file(const String &p_path, const String &p_new_path); + static bool _should_skip_directory(const String &p_path); + EditorFileSystem(); ~EditorFileSystem(); }; diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index ef35d040683..0e3cc054104 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -2774,6 +2774,9 @@ public: print_verbose("- custom build enabled: " + bool_to_string(use_custom_build)); print_verbose("- apk expansion enabled: " + bool_to_string(apk_expansion)); print_verbose("- enabled abis: " + String(",").join(enabled_abis)); + print_verbose("- export filter: " + itos(p_preset->get_export_filter())); + print_verbose("- include filter: " + p_preset->get_include_filter()); + print_verbose("- exclude filter: " + p_preset->get_exclude_filter()); Ref splash_image; Ref splash_bg_color_image;