summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-08-09 13:45:30 +0200
committerRémi Verschelde <rverschelde@gmail.com>2019-08-12 13:31:59 +0200
commit37a16fee05f2ee528c8556af9f4337a909e58de5 (patch)
treefbb29752990919ee836128994a194a2370bfa3e0 /editor/plugins
parent5441aaf768d6dd4c3d8465e6b340ae38ddc7db1d (diff)
Export: Remove temp files from cache after export
So far we left most temporary files lying around, so this attempts to fix that. I added a helper method to DirAccess to factor out the boilerplate of creating a DirAccess, checking if the file exists, remove it or print an error on failure.
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 4a2295fab2..5679426eb5 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -354,16 +354,16 @@ void EditorAssetLibraryItemDownload::_http_download_completed(int p_status, int
} break;
case HTTPRequest::RESULT_REQUEST_FAILED: {
error_text = TTR("Request failed, return code:") + " " + itos(p_code);
- status->set_text(TTR("Request Failed."));
+ status->set_text(TTR("Request failed."));
} break;
case HTTPRequest::RESULT_DOWNLOAD_FILE_CANT_OPEN:
case HTTPRequest::RESULT_DOWNLOAD_FILE_WRITE_ERROR: {
- error_text = TTR("Cannot save response to") + " " + download->get_download_file();
+ error_text = TTR("Cannot save response to:") + " " + download->get_download_file();
status->set_text(TTR("Write error."));
} break;
case HTTPRequest::RESULT_REDIRECT_LIMIT_REACHED: {
error_text = TTR("Request failed, too many redirects");
- status->set_text(TTR("Redirect Loop."));
+ status->set_text(TTR("Redirect loop."));
} break;
case HTTPRequest::RESULT_TIMEOUT: {
error_text = TTR("Request failed, timeout");
@@ -472,9 +472,8 @@ void EditorAssetLibraryItemDownload::_notification(int p_what) {
}
void EditorAssetLibraryItemDownload::_close() {
- DirAccess *da = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
- da->remove(download->get_download_file()); //clean up removed file
- memdelete(da);
+ // Clean up downloaded file.
+ DirAccess::remove_file_or_error(download->get_download_file());
queue_delete();
}