diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2020-06-11 09:30:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-11 09:30:16 +0200 |
commit | 4af5dfb12fbe5298dc77d1d63976c858fd7d5017 (patch) | |
tree | b3f1061d38c5c81fb9e2d94035f2c869a70418ce | |
parent | c2b43403b4850b679bcf2524eac5bc2d52eec8f2 (diff) | |
parent | 44094b082d56daa2eab5a8f6c6d73f86d8b18d8b (diff) |
Merge pull request #39434 from mrushyendra/export_update_files_master
Account for file deletion and renaming in Export Presets
-rw-r--r-- | editor/editor_export.cpp | 19 | ||||
-rw-r--r-- | editor/editor_export.h | 2 | ||||
-rw-r--r-- | editor/project_export.cpp | 1 |
3 files changed, 21 insertions, 1 deletions
diff --git a/editor/editor_export.cpp b/editor/editor_export.cpp index 716ead9afc..25594bf7c8 100644 --- a/editor/editor_export.cpp +++ b/editor/editor_export.cpp @@ -90,6 +90,19 @@ Ref<EditorExportPlatform> EditorExportPreset::get_platform() const { return platform; } +void EditorExportPreset::update_files_to_export() { + Vector<String> to_remove; + for (Set<String>::Element *E = selected_files.front(); E; E = E->next()) { + if (!FileAccess::exists(E->get())) { + to_remove.push_back(E->get()); + } + } + for (int i = 0; i < to_remove.size(); ++i) { + selected_files.erase(to_remove[i]); + } + EditorExport::singleton->save_presets(); +} + Vector<String> EditorExportPreset::get_files_to_export() const { Vector<String> files; for (Set<String>::Element *E = selected_files.front(); E; E = E->next()) { @@ -1298,7 +1311,11 @@ void EditorExport::load_config() { Vector<String> files = config->get_value(section, "export_files"); for (int i = 0; i < files.size(); i++) { - preset->add_export_file(files[i]); + if (!FileAccess::exists(files[i])) { + preset->remove_export_file(files[i]); + } else { + preset->add_export_file(files[i]); + } } } diff --git a/editor/editor_export.h b/editor/editor_export.h index 4978b39248..8ad8326f10 100644 --- a/editor/editor_export.h +++ b/editor/editor_export.h @@ -94,6 +94,8 @@ public: bool has(const StringName &p_property) const { return values.has(p_property); } + void update_files_to_export(); + Vector<String> get_files_to_export() const; void add_export_file(const String &p_path); diff --git a/editor/project_export.cpp b/editor/project_export.cpp index e5372a5d47..c53a59604a 100644 --- a/editor/project_export.cpp +++ b/editor/project_export.cpp @@ -163,6 +163,7 @@ void ProjectExportDialog::_update_presets() { if (preset->is_runnable()) { name += " (" + TTR("Runnable") + ")"; } + preset->update_files_to_export(); presets->add_item(name, preset->get_platform()->get_logo()); } |