0 votes

I'm trying to export my project which includes a database file. I tried to go into the resources tab in the export window and include it under the "Filters to export non-resource files" list. However, it is still not including the file during export.

I've tried varying ways *.db, data.db, res://data.db etc... non of which worked.

Export Window

in Engine by (12 points)

However, it is still not including the file during export.

How did you checked that your file is not included?

Well in the folder that I selected to export to the .db file was not there and when I launched the game it crashes without it, but when I manually copy and paste the file to where I have the exported project then it will work.

The exporting process packs all your resources inside a .pck file, or within the executable depending on which option you chose. So you.db file is probably inside it instead. Godot does not leave files unpackaged next to the executable.
Maybe you should be able to access this file by using res://path/to/file.db as it was in your project? (the res:// specifies resources access, for example that's how Godot can still load your scenes by path even though these files don't seem to be present after export: they are in the .pck).
Otherwise you may have to place the raw file yourself next to the executable if that's what you want (and you might have to if your game also modifies that database).

When accessing the database I have the code to look for "res://data.db". However, I did notice that the "data.db" file is not showing up in the Godot IDE. which is why I thought I had to include it in that list under export. As of currently if I don't copy and paste the .db file to be in the same folder as the exported .exe then the program crashes which makes me believe that it is not currently being included in the .pck file.

The file is not showing in the Godot IDE because there is no ResourceLoader able to load this as a resource, just like .json, .txt, .blend, .import or even .godot files themselves. This does not mean you can't load them IMO, and they should end up in the .pck.
If you open the .pck with Notepad++, you should be able to find a mention of your .db file with Ctrl+F. You can only be sure it's not in the .pck by actually looking there first. If it is, that could be a bug with File. If it's not, then the problem is export.
Can you paste the code you are using to load the file?

Edit: actually, is that .db file read by the SQlite plugin? Because that would be a completely different problem: https://github.com/khairul169/gdsqlite-native/issues/9

2 Answers

+1 vote

same problem with .txt files

by (52 points)
–1 vote

Leaving the answer for future resources.

At the Export screen, at the resources tab, if you add *.txt, *.db or whatever you want do add in the export files that are not showing in your editor, at the field "Filters to export non-resource files/folders", this will fix your problem.

by (12 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.