+1 vote

Hi,

I'm making a game in gdscript in which i made a save system that work like this :

const filepath = "res://save/lists.save"

func load_list():
    var file = File.new()
    if not file.file_exists(filepath): return
    file.open(filepath, File.READ)
    saved_list = file.get_var()
    file.close()
    pass

func save_list():
    var file = File.new()
    file.open(filepath, File.WRITE)
    file.store_var(saved_list)
    file.close()
    pass

In my file, i store a list of array. This code seems to work if i use it in the engine. But when i'm exporting my game, it doesn't work anymore. I can use the array that i did in the engine, when i use "save_list()" it works when i'm in the game but as soon as i close the game, "lists.save" return as when i exported the game.

I'm sorry if i'm not clear, i'm not native English speaker so i hope you'll understand.

loloid

in Engine by (18 points)

1 Answer

+1 vote
Best answer

iam not sure but i suspect you have to use "user://[filepath]" as path, because thats the only place where you have writing access

than in windows you find this file in %appdata%/godot/[your_project]/

by (75 points)
selected by
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.