class_name TestFiles extends RefCounted ## Temporary folders below user://tests for tests that write files, so that ## tests never touch the player's real key, save or recordings. static func temporary_dir(label: String) -> String: var path := "user://tests".path_join("%s-%d" % [label, Time.get_ticks_usec()]) DirAccess.make_dir_recursive_absolute(path) return path static func remove_dir(path: String) -> void: for file in DirAccess.get_files_at(path): DirAccess.remove_absolute(path.path_join(file)) for directory in DirAccess.get_directories_at(path): remove_dir(path.path_join(directory)) DirAccess.remove_absolute(path)