3232
3333#include " core/config/project_settings.h"
3434#include " core/crypto/crypto_core.h"
35- #include " core/error/error_macros.h"
3635#include " core/extension/gdextension.h"
37- #include " core/io/dir_access.h"
3836#include " core/io/file_access_encrypted.h"
3937#include " core/io/file_access_pack.h"
4038#include " core/math/random_pcg.h"
4139#include " core/version.h"
4240#include " editor/export/editor_export_platform.h"
43- #include " editor/export/editor_export_platform_data.h"
44- #include " editor/export/editor_export_preset.h"
4541#include " editor/file_system/editor_file_system.h"
4642#include " editor/file_system/editor_paths.h"
4743
@@ -215,15 +211,15 @@ bool EditorExportPlatformUtils::encrypt_and_store_directory(Ref<FileAccess> p_fd
215211
216212Error EditorExportPlatformUtils::encrypt_and_store_data (Ref<FileAccess> p_fd, const String &p_path, const Vector<uint8_t > &p_data, const Vector<String> &p_enc_in_filters, const Vector<String> &p_enc_ex_filters, const Vector<uint8_t > &p_key, uint64_t p_seed, bool &r_encrypt) {
217213 r_encrypt = false ;
218- for (int i = 0 ; i < p_enc_in_filters. size (); ++i ) {
219- if (p_path.matchn (p_enc_in_filters[i] ) || p_path.trim_prefix (" res://" ).matchn (p_enc_in_filters[i] )) {
214+ for (const String &enc_in_filter : p_enc_in_filters) {
215+ if (p_path.matchn (enc_in_filter ) || p_path.trim_prefix (" res://" ).matchn (enc_in_filter )) {
220216 r_encrypt = true ;
221217 break ;
222218 }
223219 }
224220
225- for (int i = 0 ; i < p_enc_ex_filters. size (); ++i ) {
226- if (p_path.matchn (p_enc_ex_filters[i] ) || p_path.trim_prefix (" res://" ).matchn (p_enc_ex_filters[i] )) {
221+ for (const String &enc_ex_filter : p_enc_ex_filters) {
222+ if (p_path.matchn (enc_ex_filter ) || p_path.trim_prefix (" res://" ).matchn (enc_ex_filter )) {
227223 r_encrypt = false ;
228224 break ;
229225 }
@@ -419,10 +415,10 @@ void EditorExportPlatformUtils::export_find_dependencies(const String &p_path, H
419415 return ;
420416 }
421417
422- Vector<String> deps = dir->get_file_deps (file_idx);
418+ PackedStringArray deps = dir->get_file_deps (file_idx);
423419
424- for (int i = 0 ; i < deps. size (); i++ ) {
425- EditorExportPlatformUtils::export_find_dependencies (deps[i] , p_paths);
420+ for (const String &dep : deps) {
421+ EditorExportPlatformUtils::export_find_dependencies (dep , p_paths);
426422 }
427423}
428424
@@ -434,9 +430,9 @@ void EditorExportPlatformUtils::export_find_preset_resources(const Ref<EditorExp
434430 EditorExportPlatformUtils::export_find_resources (EditorFileSystem::get_singleton ()->get_filesystem (), p_paths);
435431
436432 if (export_filter == EditorExportPreset::EXCLUDE_SELECTED_RESOURCES) {
437- Vector<String> excluded_resources = p_preset->get_files_to_export ();
438- for (int i = 0 ; i < excluded_resources. size (); i++ ) {
439- p_paths.erase (excluded_resources[i] );
433+ PackedStringArray excluded_resources = p_preset->get_files_to_export ();
434+ for (const String &excluded_resource : excluded_resources) {
435+ p_paths.erase (excluded_resource );
440436 }
441437 }
442438 } break ;
@@ -449,13 +445,13 @@ void EditorExportPlatformUtils::export_find_preset_resources(const Ref<EditorExp
449445 case EditorExportPreset::EXPORT_SELECTED_RESOURCES: {
450446 bool scenes_only = export_filter == EditorExportPreset::EXPORT_SELECTED_SCENES;
451447
452- Vector<String> files = p_preset->get_files_to_export ();
453- for (int i = 0 ; i < files. size (); i++ ) {
454- if (scenes_only && ResourceLoader::get_resource_type (files[i] ) != " PackedScene" ) {
448+ PackedStringArray files = p_preset->get_files_to_export ();
449+ for (const String &file : files) {
450+ if (scenes_only && ResourceLoader::get_resource_type (file ) != " PackedScene" ) {
455451 continue ;
456452 }
457453
458- EditorExportPlatformUtils::export_find_dependencies (files[i] , p_paths);
454+ EditorExportPlatformUtils::export_find_dependencies (file , p_paths);
459455 }
460456
461457 // Add autoload resources and their dependencies
@@ -506,8 +502,8 @@ void EditorExportPlatformUtils::edit_files_with_filter(Ref<DirAccess> &da, const
506502 String fullpath = cur_dir + f;
507503 // Test also against path without res:// so that filters like `file.txt` can work.
508504 String fullpath_no_prefix = cur_dir_no_prefix + f;
509- for (int i = 0 ; i < p_filters. size (); ++i ) {
510- if (fullpath.matchn (p_filters[i] ) || fullpath_no_prefix.matchn (p_filters[i] )) {
505+ for (const String &filter : p_filters) {
506+ if (fullpath.matchn (filter ) || fullpath_no_prefix.matchn (filter )) {
511507 if (!exclude) {
512508 r_list.insert (fullpath);
513509 } else {
@@ -521,8 +517,7 @@ void EditorExportPlatformUtils::edit_files_with_filter(Ref<DirAccess> &da, const
521517
522518 da->list_dir_end ();
523519
524- for (int i = 0 ; i < dirs.size (); ++i) {
525- const String &dir = dirs[i];
520+ for (const String &dir : dirs) {
526521 if (dir.begins_with (" ." )) {
527522 continue ;
528523 }
0 commit comments