I have a questions when I export my project to Android.
I have the following files and folders in my res://
res://addons/godot-sqlite/
res://dataStore/database.db
res://dataStore/database.sqbpro
res://globalenv/globalfunctions.gd
res://globalenv/globalvar.gd
res://scenes/
I have some issues with exporting my local db in the Android export, for example, I have in my code the following variables:
const SQLite = preload("res://addons/godot-sqlite/bin/gdsqlite.gdns")
var db # database object
var db_name = "res://dataStore/database.db" # database path
I've changed the path of the database.db to
var db_name = "user://database.db"
A then I copied the database.db to my
C:\Users\Username\AppData\Roaming\Godot\app_userdata\project-name
In the Godot "Play the project" button the database is working fine but when I export the project to Android adding the database.db
to the non-resources filter in resources and the .apk
is installed the login is not working.
filter to export non-resources files
any ideas?
Thank you all!
Add the export with a wildcard, e.g. *.db
. There is an issue - which I believe still stands - that this option does not work if it does not have a wildcard.
That should make the *.db
files available in their res://
path. Which is read only.
Since read only is not good for a database, copy it to the user://
path. You can use an object of the Directory
class to check if it already exists, and to copy from res://
to user://
if it doesn't.
Then proceed to work with the database from the user://
path.