I think if you export the game as a ZIP file, then you can see if the database is included in the export by looking at the zip file. If it exists in res://
, you could try something like this to move it to user://
, though I'm not sure if it would work:
var original_sql_file = File;
original_sql_file.open("res://sql_database.db", File.READ)
var original_sql_file_buffer = original_sql_file.get_buffer(original_sql_file.get_len())
original_sql_file.close()
var new_sql_file = File;
new_sql_file.open("user://sql_database.db", File.WRITE)
new_sql_file.store_buffer(original_sql_file_buffer)
new_sql_file.close()
You could also, potentially, have the database included as a download alongside the executable. Then you could use something like this to get the path to it:
var executable_folder = OS.get_executable_path.get_base_dir()
var sql_database = executable_folder + "/sql_database.db"
# then you should be able to load it from the file path
However, this has the downside of needing to have the database included in the download next to the executable, which may be undesired and I'm not sure if it would work on Android or iOS.