提交 3db2aa30 编写于 作者: aaronchen2k2k's avatar aaronchen2k2k

fix issue#3353

上级 873a2588
......@@ -8,7 +8,7 @@ import (
i118Utils "github.com/easysoft/zendata/src/utils/i118"
logUtils "github.com/easysoft/zendata/src/utils/log"
"github.com/easysoft/zendata/src/utils/vari"
"github.com/mattn/go-runewidth"
"log"
"strings"
)
......@@ -17,6 +17,11 @@ const (
)
func Decode(defaultFile, configFile, fieldsToExportStr, input, output string) {
vari.DefaultDir = fileUtils.GetAbsDir(defaultFile)
vari.ConfigDir = fileUtils.GetAbsDir(configFile)
vari.Total = 10
fieldsToExport := make([]string, 0)
if fieldsToExportStr != "" {
fieldsToExport = strings.Split(fieldsToExportStr, ",")
......@@ -27,7 +32,7 @@ func Decode(defaultFile, configFile, fieldsToExportStr, input, output string) {
data := fileUtils.ReadFile(input)
ret := []map[string]interface{}{}
var ret []map[string]interface{}
LinesToMap(data, fieldsToExport, &ret)
jsonObj, _ := json.Marshal(ret)
vari.JsonResp = string(jsonObj)
......@@ -78,8 +83,9 @@ func decodeOneLevel(line string, fields []model.DefField, rowMap *map[string]int
if len(sep) > 0 {
index := searchRune(left, sep)
if index > -1 {
col = string(left[: index+runewidth.StringWidth(field.Postfix)])
left = left[index+runewidth.StringWidth(field.Prefix)+1:]
col = string(left[: index + len(field.Postfix)])
left = left[index + len(field.Postfix):]
log.Println(left)
}
} else if j == len(fields) - 1 {
col = string(left)
......
package fileUtils
import (
"fmt"
"github.com/easysoft/zendata/res"
commonUtils "github.com/easysoft/zendata/src/utils/common"
constant "github.com/easysoft/zendata/src/utils/const"
......@@ -129,7 +128,7 @@ func GetExeDir() string { // where zd.exe file in
dir, _ = filepath.Abs(dir)
dir = AddSepIfNeeded(dir)
fmt.Printf("Debug: Launch %s in %s \n", arg1, dir)
//fmt.Printf("Debug: Launch %s in %s \n", arg1, dir)
return dir
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册