+1 vote

The following code works when I start the game from the editor:

var dir = Directory.new()
dir.remove("path/to/file")

But after exporting the game to Debug or Release, seems like it does nothing

What is happening?

After remove, I check if the file exists with

dir.file_exists("path/to/file")

It works, but then dir.remove does nothing

Thanks in advance

P.S: I'm using Godot 3.1.1 stable with W10

asked May 18 in Engine by jolsensei (18 points)
edited May 18 by jolsensei

1 Answer

+1 vote
Best answer

what is your path( user// or res//)?

you cannot change the res// paths after exporting the game in order to avoid messing with the game's files

answered May 18 by rustyStriker (543 points)
selected May 18 by jolsensei

Yeah, that was the problem, I was using res// instead of user//
I didn't know that you can't delete in res// after exporting the game

Thank you so much!

P.S: There is a way to change user// path? In W10 is so long and I'd like to change it to something like a folder in my Desktop or the exported game root folder

To customize the user data directory name, you can enable Application → Config → Use Custom User Dir in the project settings and set Custom User Dir Name. The directory will be located in %APPDATA%\(custom user dir name).

However, it doesn't seem to be possible to place it in another location.

Oh, that's a pitty
Thank you! At last it's shorter than the default path :D

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.