From 37a16fee05f2ee528c8556af9f4337a909e58de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Fri, 9 Aug 2019 13:45:30 +0200 Subject: 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. --- modules/gdscript/register_types.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'modules') diff --git a/modules/gdscript/register_types.cpp b/modules/gdscript/register_types.cpp index b8a13ed91b..62117dcaf3 100644 --- a/modules/gdscript/register_types.cpp +++ b/modules/gdscript/register_types.cpp @@ -32,6 +32,7 @@ #include "core/io/file_access_encrypted.h" #include "core/io/resource_loader.h" +#include "core/os/dir_access.h" #include "core/os/file_access.h" #include "editor/gdscript_highlighter.h" #include "gdscript.h" @@ -117,6 +118,9 @@ public: file = FileAccess::get_file_as_array(tmp_path); add_file(p_path.get_basename() + ".gde", file, true); + // Clean up temporary file. + DirAccess::remove_file_or_error(tmp_path); + } else { add_file(p_path.get_basename() + ".gdc", file, true); -- cgit v1.2.3