Skip to content

Commit 45fc515

Browse files
committed
Merge pull request godotengine#106749 from KoBeWi/hard-coding_is_bad_for_your_health
Don't hard-code test path when deleting test data
2 parents 7bc33bd + e7d3163 commit 45fc515

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

tests/test_main.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -234,11 +234,9 @@ int test_main(int argc, char *argv[]) {
234234

235235
WorkerThreadPool::get_singleton()->init();
236236

237-
String test_path = OS::get_singleton()->get_cache_path().path_join("godot_test");
238-
239-
Ref<DirAccess> da;
240-
if (DirAccess::exists(test_path)) {
241-
da = DirAccess::open(test_path);
237+
{
238+
const String test_path = TestUtils::get_temp_path("");
239+
Ref<DirAccess> da = DirAccess::open(test_path); // get_temp_path() automatically creates the folder.
242240
ERR_FAIL_COND_V(da.is_null(), 0);
243241
ERR_FAIL_COND_V_MSG(da->erase_contents_recursive() != OK, 0, "Failed to delete files");
244242
}

0 commit comments

Comments
 (0)