0 votes

I am making a project in which user is required to get files from os is there any way to get files

Godot version latest
in Engine by (14 points)

1 Answer

0 votes

Yes using File class like this example from the docs.

func save(): 
        var file = File.new()
        file.open("user://save_game.dat", File.WRITE)
        file.store_string(content)
        file.close()

func load():
    var file = File.new()
    file.open("user://save_game.dat", File.READ)
    var content = file.get_as_text()
    file.close()
    return content

You may need to read about Data Paths here to see where the files are stored in the os here: https://docs.godotengine.org/en/3.3/tutorials/io/data_paths.html

by (1,051 points)
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.