summaryrefslogtreecommitdiff
path: root/platform/javascript
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-08-12 14:55:15 +0200
committerGitHub <noreply@github.com>2019-08-12 14:55:15 +0200
commitd7f3de8581c88d88595615db01f177161a032b26 (patch)
treefbb29752990919ee836128994a194a2370bfa3e0 /platform/javascript
parent5441aaf768d6dd4c3d8465e6b340ae38ddc7db1d (diff)
parent37a16fee05f2ee528c8556af9f4337a909e58de5 (diff)
Merge pull request #31235 from akien-mga/clean-cache-after-export
Export: Remove temp files from cache after export
Diffstat (limited to 'platform/javascript')
-rw-r--r--platform/javascript/export/export.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/platform/javascript/export/export.cpp b/platform/javascript/export/export.cpp
index c68b420c61..69dd038709 100644
--- a/platform/javascript/export/export.cpp
+++ b/platform/javascript/export/export.cpp
@@ -362,12 +362,21 @@ int EditorExportPlatformJavaScript::get_device_count() const {
Error EditorExportPlatformJavaScript::run(const Ref<EditorExportPreset> &p_preset, int p_device, int p_debug_flags) {
- String path = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_export.html");
+ String basepath = EditorSettings::get_singleton()->get_cache_dir().plus_file("tmp_js_export");
+ String path = basepath + ".html";
Error err = export_project(p_preset, true, path, p_debug_flags);
- if (err) {
+ if (err != OK) {
+ // Export generates several files, clean them up on failure.
+ DirAccess::remove_file_or_error(basepath + ".html");
+ DirAccess::remove_file_or_error(basepath + ".js");
+ DirAccess::remove_file_or_error(basepath + ".pck");
+ DirAccess::remove_file_or_error(basepath + ".png");
+ DirAccess::remove_file_or_error(basepath + ".wasm");
return err;
}
OS::get_singleton()->shell_open(String("file://") + path);
+ // FIXME: Find out how to clean up export files after running the successfully
+ // exported game. Might not be trivial.
return OK;
}