fix: 优化 exporter 配置导出器在没有前缀时会默认增加一个 "." 的问题

This commit is contained in:
kercylan98 2023-10-25 10:07:36 +08:00
parent 68586bfd7c
commit fb5dacb4b4
2 changed files with 6 additions and 1 deletions

View File

@ -83,7 +83,12 @@ func init() {
if raw, err := exporter.ExportData(tmpls.NewJSON(), loader.LoadData(cx)); err != nil {
return err
} else {
jsonPath := filepath.Join(outPath, fmt.Sprintf("%s.%s.json", prefix, cx.GetConfigName()))
var jsonPath string
if len(prefix) == 0 {
jsonPath = filepath.Join(outPath, fmt.Sprintf("%s.json", cx.GetConfigName()))
} else {
jsonPath = filepath.Join(outPath, fmt.Sprintf("%s.%s.json", prefix, cx.GetConfigName()))
}
if err := file.WriterFile(jsonPath, raw); err != nil {
return err
}

Binary file not shown.