diff options
author | RĂ©mi Verschelde <rverschelde@gmail.com> | 2018-02-19 21:31:26 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-02-19 21:31:26 +0100 |
commit | 3564895b63c50c2c903750df63b6f39bf0c35d37 (patch) | |
tree | 4e442e3daadb8353295ad0205789c58b0962f049 | |
parent | 2a723519c042e0a143807e0b3e6a7367bfcb02dc (diff) | |
parent | b4f1a035e327b6e9f0f4a02040175b23bf5eac3f (diff) |
Merge pull request #16430 from dragmz/download_tpl_to_file
Download export templates to a file (instead of memory) using separate thread
-rw-r--r-- | editor/export_template_manager.cpp | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/editor/export_template_manager.cpp b/editor/export_template_manager.cpp index c4ecf3c098..41b016bdca 100644 --- a/editor/export_template_manager.cpp +++ b/editor/export_template_manager.cpp @@ -402,19 +402,10 @@ void ExportTemplateManager::_http_download_templates_completed(int p_status, int if (p_code != 200) { template_list_state->set_text(TTR("Failed:") + " " + itos(p_code)); } else { - String path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_templates.tpz"); - FileAccess *f = FileAccess::open(path, FileAccess::WRITE); - if (!f) { - template_list_state->set_text(TTR("Can't write file.")); - } else { - int size = p_data.size(); - PoolVector<uint8_t>::Read r = p_data.read(); - f->store_buffer(r.ptr(), size); - memdelete(f); - template_list_state->set_text(TTR("Download Complete.")); - template_downloader->hide(); - _install_from_file(path, false); - } + String path = download_templates->get_download_file(); + template_list_state->set_text(TTR("Download Complete.")); + template_downloader->hide(); + _install_from_file(path, false); } } break; } @@ -437,6 +428,8 @@ void ExportTemplateManager::_begin_template_download(const String &p_url) { } download_data.clear(); + download_templates->set_download_file(EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_templates.tpz")); + download_templates->set_use_threads(true); Error err = download_templates->request(p_url); if (err != OK) { |