summaryrefslogtreecommitdiffstats
path: root/tests/test_utils.cpp
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2024-06-13 17:19:20 +0200
committerRémi Verschelde <rverschelde@gmail.com>2024-06-13 17:19:20 +0200
commitfe61f94c7ed6a9eb3fb6cb17026a9060afbe75a5 (patch)
tree0c3271a2213c42b956dda59fb076c6598df5586e /tests/test_utils.cpp
parente15c2e051e4d5b2257b5ea24e466b4056d8c2310 (diff)
parent5514b2c70c28a6133459075f85746fe05aaecc68 (diff)
downloadredot-engine-fe61f94c7ed6a9eb3fb6cb17026a9060afbe75a5.tar.gz
Merge pull request #92810 from KoBeWi/redirect_tests_to_dev/null
Use subfolder for temporary test files
Diffstat (limited to 'tests/test_utils.cpp')
-rw-r--r--tests/test_utils.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test_utils.cpp b/tests/test_utils.cpp
index cbd6d1ffbb..9d41e74020 100644
--- a/tests/test_utils.cpp
+++ b/tests/test_utils.cpp
@@ -30,6 +30,7 @@
#include "tests/test_utils.h"
+#include "core/io/dir_access.h"
#include "core/os/os.h"
String TestUtils::get_data_path(const String &p_file) {
@@ -40,3 +41,9 @@ String TestUtils::get_data_path(const String &p_file) {
String TestUtils::get_executable_dir() {
return OS::get_singleton()->get_executable_path().get_base_dir();
}
+
+String TestUtils::get_temp_path(const String &p_suffix) {
+ const String temp_base = OS::get_singleton()->get_cache_path().path_join("godot_test");
+ DirAccess::make_dir_absolute(temp_base); // Ensure the directory exists.
+ return temp_base.path_join(p_suffix);
+}