Export not including non-resource files

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Diogenez

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

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

How did you checked that your file is not included?

Zylann | 2019-07-05 22:57

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.

Diogenez | 2019-07-06 00:07

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).

Zylann | 2019-07-06 00:11

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.

Diogenez | 2019-07-06 01:37

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: DB Location is limited to user:\\ · Issue #9 · khairul169/gdsqlite-native · GitHub

Zylann | 2019-07-06 15:32

:bust_in_silhouette: Reply From: burstina

same problem with .txt files

:bust_in_silhouette: Reply From: daniyyel

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.