From 2b1686d9a1d2d41817a4f9fcc8b098f1bdca1248 Mon Sep 17 00:00:00 2001 From: Antkites Date: Mon, 12 Aug 2024 22:32:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=9D=9E=E6=B3=95?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E8=BE=93=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/unpack/uconfig.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/unpack/uconfig.go b/internal/unpack/uconfig.go index c84203b..238f2b0 100644 --- a/internal/unpack/uconfig.go +++ b/internal/unpack/uconfig.go @@ -54,6 +54,12 @@ func changeExt(filename, newExt string) string { // save 保存内容到文件 func save(filename string, content []byte) error { + // 处理文件路径 + filename = filepath.ToSlash(filename) + if idx := strings.Index(filename, ":"); idx != -1 { + filename = filename[:idx+1] + strings.ReplaceAll(filename[idx+1:], ":", "") + } + // 判断目录是否存在 dir := filepath.Dir(filename) if _, err := os.Stat(dir); os.IsNotExist(err) { @@ -240,7 +246,7 @@ func (p *ConfigParser) Parse(option config.WxapkgInfo) error { windowContent, _ := json.MarshalIndent(e.Page[a].Window, "", " ") err = save(fileName, windowContent) if err != nil { - return err + log.Printf("Error saving file %s: %v\n", fileName, err) } } }