Prepopulate user://

Godot Version

4.2.1

Question

Hello and thank you for reading my question!

I have a project that uses SQLite to store and retrieve data. It’s an educational language game, so there is a lot of data and it was much easier to store text in SQL for me as I do database programming for my day job.

All of that works in the project with installed plugins, but the problem comes when I export the project. The database file is in res:// and on Windows, when I run the application it creates an empty .db file in the installed folder. It does not have the data already written to it.

I’m still new to Godot, but I heard that user:// is the proper place for files like this, where we want to read and write. I can make a new database file in user://, but is there a way to “prepopulate” the user:// folder with, for example, a database file that has the data in it already?

Any help you could provide would be much appreciated.

Thanks!
Lexen

The res:// files are packed into the standalone or embedded .pck file. Either way, if you have a .db file in res:// all you have to do is make your program copy that from res:// to user:// if there’s not such a file in user://
That’s how config files with defaults are made too.

1 Like