+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

in Engine by (18 points)
edited by

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

by (1,192 points)
selected by

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.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.