I'm trying to read in a list of names from a text file into an Array using this code:
var sector_names = []
const sector_names_path = "res://sector_names.txt"
var curr_file = File.new()
curr_file.open(sector_names_path, curr_file.READ)
while (!curr_file.eof_reached()):
sector_names.append(curr_file.get_line())
curr_file.close()
However, this fails to actually read any data and instead generates an infinite series of errors:
ERROR: _File::eof_reached: Condition ' !f ' is true. returned: false
At: core\bind\core_bind.cpp:1493
ERROR: _File::get_line: Condition ' !f ' is true. returned: String()
At: core\bind\core_bind.cpp:1588
ERROR: _File::eof_reached: Condition ' !f ' is true. returned: false
At: core\bind\core_bind.cpp:1493
ERROR: _File::get_line: Condition ' !f ' is true. returned: String()
At: core\bind\core_bind.cpp:1588
The sector_names.txt file is in the root folder of the project, the same folder the script is in. I'm loading the script as a singleton - maybe that has something to do with it? I'm running Godot v2.1.4stable on a Windows 10 machine, and all my Godot files, including the Godot application itself, are on an external HDD.
Since I'm new to Godot, I suspect this is the result of a mistake on my part. Any advice would be appreciated!