save and load installs

This commit is contained in:
2023-05-27 07:36:20 +03:00
parent 34dbb91570
commit f942c91cf6
4 changed files with 61 additions and 10 deletions

View File

@ -4,7 +4,7 @@ class_name GroupMetadata
@export var name: String
@export var icon_path: String
@export var description: String
@export var installs: Array[InstallMetadata]
@export var installs: Array[Dictionary]
@export var settings_overrides: Dictionary
@export var index: int

View File

@ -1,7 +1,30 @@
extends Resource
class_name InstallMetadata
@export var name: String
@export var icon_path: String
@export var binary_path: String
@export var local_overrides: Dictionary
var name: String
var icon_path: String
var binary_path: String
var local_overrides: Dictionary
var pids: Array[int] = []
var index: int = 0
func to_d() -> Dictionary:
return {
"name": name,
"icon_path": icon_path,
"binary_path": binary_path,
"local_overrides": local_overrides,
"pids": pids,
"index": index,
}
static func from_d(d: Dictionary) -> InstallMetadata:
var res := InstallMetadata.new()
res.name = d.get("name", "")
res.icon_path = d.get("icon_path", "")
res.binary_path = d.get("binary_path", "")
res.local_overrides = d.get("local_overrides", {})
res.pids = d.get("pids", [])
res.index = d.get("index", 0)
return res