MCPcopy Create free account
hub / github.com/OpenAtomFoundation/SmartIDE / LoadTemplatesJson

Function LoadTemplatesJson

cli/cmd/init/global.go:49–59  ·  view source on GitHub ↗

加载templates索引json

()

Source from the content-addressed store, hash-verified

47
48// 加载templates索引json
49func LoadTemplatesJson() (templateTypes []NewTypeBO, err error) {
50 // new type转换为结构体
51 templatesPath := common.PathJoin(config.SmartIdeHome, TMEPLATE_DIR_NAME, "templates.json")
52 templatesByte, err := os.ReadFile(templatesPath)
53 if err != nil {
54 return templateTypes, errors.New(i18nInstance.New.Err_read_templates + templatesPath + err.Error())
55 }
56
57 err = json.Unmarshal(templatesByte, &templateTypes)
58 return templateTypes, err
59}
60func init() {
61
62}

Callers 1

getTemplateSettingFunction · 0.85

Calls 1

ErrorMethod · 0.45

Tested by

no test coverage detected