Hello! I'm working on a project where my data is stored in CSV files, as it is convenient to edit. I'm not using the CSV files as localization files, but as files containing data (strings) used in the game. I reimported the CSV file I use as a test as "keep file" and not "CSV translation", and there's a red cross in its right (which is weird because I change my version of Godot today and I believe in the previous version I had I could reimport the CSV file as something else and there was no red cross if I remember correctly).
I created a little method to read a CSV file and print the lines it contains. Here is the method:
# Read a CSV file and print all its lines
func read_csv(pFilepath):
var file = File.new()
file.open(pFilepath, file.READ)
while !file.eof_reached():
var line_array = file.get_csv_line(";")
for line in line_array:
print("---------------------")
print(line)
file.close()
It all works perfectly fine in the editor. The problem is that once the project is exported as an application (currently on macOS), or if I try to play it using an HTML5 application, the program is unable to process this method, and I think this is because once compiled the program cannot access external files. I already had the problem on another project with txt files instead of CSV files. I ended up copy pasting what the txt contained in a script inside my game, but this is not possible for this project as it will contain a lot of CSV files and it will not be convenient to do it this way. I was also wondering how I'm supposed to handle external files if I want to make an iOS and android build of my game too. Like, is it possible to handle the external files the same way and keep just one project or should I have to create different versions with different code? What about the HTLM5 version of my game (if I want one)?
There's definitely something I'm doing wrong regarding the use of external files (like CSV but also txt or even a custom file for example). I red the documentation again but was unable to find any clue.
Thanks for the help.