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

asked Jul 5, 2019 in Engine by Diogenez (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

1 Answer

0 votes

same problem with .txt files

answered Oct 11, 2019 by burstina (44 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.