diff options
author | Rémi Verschelde <remi@verschelde.fr> | 2022-03-11 12:51:22 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-11 12:51:22 +0100 |
commit | 015fdfc28d3709387383b365a91c78dc0fe7aa35 (patch) | |
tree | 16a7a83bd1083ac61e30039db8a573e930ca35b8 /platform/javascript/export/export_plugin.cpp | |
parent | 1e099afc8ac420f5c97b07067e28d6309ed55ae7 (diff) | |
parent | 768f9422bc3b1349729b8a50feb8c0797003aee9 (diff) | |
download | redot-engine-015fdfc28d3709387383b365a91c78dc0fe7aa35.tar.gz |
Merge pull request #58986 from akien-mga/diraccessref
Diffstat (limited to 'platform/javascript/export/export_plugin.cpp')
-rw-r--r-- | platform/javascript/export/export_plugin.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/platform/javascript/export/export_plugin.cpp b/platform/javascript/export/export_plugin.cpp index c7e503732d..e7855acf60 100644 --- a/platform/javascript/export/export_plugin.cpp +++ b/platform/javascript/export/export_plugin.cpp @@ -252,7 +252,7 @@ Error EditorExportPlatformJavaScript::_build_pwa(const Ref<EditorExportPreset> & // Custom offline page const String offline_page = p_preset->get("progressive_web_app/offline_page"); if (!offline_page.is_empty()) { - DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); const String offline_dest = dir.plus_file(name + ".offline.html"); err = da->copy(ProjectSettings::get_singleton()->globalize_path(offline_page), offline_dest); if (err != OK) { @@ -445,18 +445,18 @@ Error EditorExportPlatformJavaScript::export_project(const Ref<EditorExportPrese EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + pck_path); return error; } - DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); - for (int i = 0; i < shared_objects.size(); i++) { - String dst = base_dir.plus_file(shared_objects[i].path.get_file()); - error = da->copy(shared_objects[i].path, dst); - if (error != OK) { - EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + shared_objects[i].path.get_file()); - memdelete(da); - return error; + + { + DirAccessRef da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM); + for (int i = 0; i < shared_objects.size(); i++) { + String dst = base_dir.plus_file(shared_objects[i].path.get_file()); + error = da->copy(shared_objects[i].path, dst); + if (error != OK) { + EditorNode::get_singleton()->show_warning(TTR("Could not write file:") + "\n" + shared_objects[i].path.get_file()); + return error; + } } } - memdelete(da); - da = nullptr; // Extract templates. error = _extract_template(template_path, base_dir, base_name, pwa); |