Now if an ess_data.json exists in the project's root, the addon will load it as the folders array.

This commit is contained in:
Relintai 2019-12-21 02:21:11 +01:00
parent 7506c76b7d
commit eac85fb441

View File

@ -247,6 +247,26 @@ var _folders : Array = [
] ]
func _ready(): func _ready():
var dir : Directory = Directory.new()
if dir.file_exists("res://ess_data.json"):
var file : File = File.new()
if file.open("res://ess_data.json", File.READ) == OK:
var s : String = file.get_as_text()
_folders = parse_json(s)
file.close()
# else:
# var file : File = File.new()
#
# if file.open("res://ess_data.json", File.WRITE) == OK:
# file.store_string(to_json(_folders))
#
# file.close()
_main_container = get_node(main_container) _main_container = get_node(main_container)
_resource_scene = resource_scene.instance() _resource_scene = resource_scene.instance()