diff --git a/tests/test_main.cpp b/tests/test_main.cpp index 96e2515dd41..4fb4160685c 100644 --- a/tests/test_main.cpp +++ b/tests/test_main.cpp @@ -30,6 +30,8 @@ #include "test_main.h" +#include "core/error/error_macros.h" +#include "core/io/dir_access.h" #include "modules/modules_enabled.gen.h" #ifdef TOOLS_ENABLED @@ -231,6 +233,15 @@ int test_main(int argc, char *argv[]) { WorkerThreadPool::get_singleton()->init(); + String test_path = OS::get_singleton()->get_cache_path().path_join("godot_test"); + + Ref da; + if (DirAccess::exists(test_path)) { + da = DirAccess::open(test_path); + ERR_FAIL_COND_V(da.is_null(), 0); + ERR_FAIL_COND_V_MSG(da->erase_contents_recursive() != OK, 0, "Failed to delete files"); + } + // Run custom test tools. if (test_commands) { for (const KeyValue &E : (*test_commands)) {