+1 vote

I just started taking a look at how my game acts when exported, and noticed that a .csv file doesn't seem to want to be exported alongside my other assets.

Here is how I use it in code:

var fr := File.new()
fr.open("res://external_resources/world-cities.csv", fr.READ)

while !fr.eof_reached():
    var csv = fr.get_csv_line()
    city_names.push_back(csv[0])

fr.close()

In export_presets.cfg I have tried specifying both

include_filter="*.csv"

as well as

include_filter="external_resources/*"

but both seem to fail to include the world-cities.csv file.

When running the exported executable in debug mode I get the following two errors

ERROR: File must be opened before use.
At: core/bind/core_bind.cpp:1956
ERROR: File must be opened before use.
At: core/bind/core_bind.cpp:2058

as well as a script error following failing to open the file.

Opening the exported .pck in a text editor and searching for the file shows it under a [deps] section, but I don't know if that means it has been included or is just used within the project.

Any help or pointers in the right direction would be appreciated!

asked May 21 in Engine by raksom (20 points)

1 Answer

+1 vote
Best answer

maybe try it as a txt (or even res) file

https://github.com/godotengine/godot/issues/17095

answered May 22 by rakkarage (1,332 points)
selected May 22 by raksom

I wasn't able to import a .txt file (for whatever reason it wouldnt show in godot's file hierarchy), but it seems to work fine as a .tres. Very strange, I will open another issue for it. Cheers!

Edit:

Actually, while godot seem to be able to parse it as a .tres as expected, the editor also throws some errors.Keeping it as a .txt even though godot doesn't want to recognize it's existance works fine however.

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.