Can't delete save file from user data folder

Godot Version

4.2.2.stable

Question

Hi everyone!
I tried to delete a save file with the DirAccess.remove_absolute() function and it just won’t work. The code reaches the remove_absolute() command and the file exists. I also get no error.
Code:

func delete_game(save_id):
	var save_game_path = "user//savegame{id}.tres"
	var formated_path = save_game_path.format({"id": save_id})
	DirAccess.remove_absolute(formated_path)

Looks like you are missing a colon after user.

var save_game_path = "user://savegame{id}.tres"

1 Like

Damn, how could I not see that! :man_facepalming:t4: :rofl:
Thank you very much for your help, it works now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.