blob: 9f7a20385a9bdf8712094cb72c4c891ae9b95276 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
extends Node
func load_parse_json (path):
var data_file = File.new()
if data_file.open(path, File.READ) != OK:
return
var data_text = data_file.get_as_text()
data_file.close()
var data_parse = JSON.parse(data_text)
if data_parse.error != OK:
return
var data = data_parse.result
return data
func parse_dir (path : String, extension : String = ""):
var files = []
var dir = Directory.new()
dir.open(path)
dir.list_dir_begin(true)
var file = dir.get_next()
while file != "":
if file.ends_with(extension):
files.append(file)
file = dir.get_next()
return files
|