Directory.remove() does not work after export to Debug or Release

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jolsensei

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

:bust_in_silhouette: Reply From: rustyStriker

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

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

jolsensei | 2019-05-18 13:47

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.

Calinou | 2019-05-18 14:41

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

jolsensei | 2019-05-18 14:44