加载templates索引json
()
| 47 | |
| 48 | // 加载templates索引json |
| 49 | func 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 | } |
| 60 | func init() { |
| 61 | |
| 62 | } |
no test coverage detected