Browse Source

chore: update config-importer.tscn

LanzaSchneider 1 year ago
parent
commit
6cee0c7094
2 changed files with 14 additions and 2 deletions
  1. 2 0
      components/editor/.gitignore
  2. 12 2
      editor/config-importer.tscn

+ 2 - 0
components/editor/.gitignore

@@ -0,0 +1,2 @@
+*.ini
+!.gitignore

+ 12 - 2
editor/config-importer.tscn

@@ -22,8 +22,18 @@ func _config_save() -> void:
 	_config.set_value(_config_section, 'config_path', $config_path.text)
 	_config.set_value(_config_section, 'config_path', $config_path.text)
 	_config.save(_config_path)
 	_config.save(_config_path)
 
 
-func _on_import_perform_button_down():
-	print(_config_path)
+func _on_import_perform_button_down() -> void:
+	var dir_access := DirAccess.open($config_path.text)
+	for config_type in dir_access.get_directories():
+		var config_type_dir: String = $config_path.text.path_join(config_type)
+		var config_dir_access := DirAccess.open(config_type_dir)
+		for config_file in config_dir_access.get_files():
+			if config_file.get_extension() != 'csv':
+				continue
+			var file_access := FileAccess.open(config_type_dir.path_join(config_file), FileAccess.READ)
+			while !file_access.eof_reached():
+				var line := file_access.get_csv_line()
+				print(line)
 "
 "
 
 
 [node name="配置" type="VBoxContainer"]
 [node name="配置" type="VBoxContainer"]