Skip to content
This repository was archived by the owner on Sep 17, 2023. It is now read-only.

Commit ff078c3

Browse files
committed
🐞 fix(资源路径): 修复某些情况下资源路径错误的问题
1 parent b44db84 commit ff078c3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/main.go

+7-1
Original file line numberDiff line numberDiff line change
@@ -228,13 +228,19 @@ func HandlingAssets(node *ast.Node, outDir string, fileEntity structAll.FileEnti
228228
for {
229229
assetsPath := path.Join(filepath.ToSlash(filepath.Dir(fileEntity.Path)), strings.Repeat("../", level), dest)
230230
matched, _ := filepath.Match(workspaceDir+"*", assetsPath)
231+
231232
if matched {
232233
_, err := os.Stat(assetsPath)
233234
if err == nil {
234235
matched, _ := filepath.Match(sourceDir+"*", assetsPath)
235236
if matched {
236237
// 资源文件在笔记本内,这里重写链接地址即可
237-
p := path.Join(strings.Repeat("../", level), dest)
238+
var p string
239+
if level == 0 {
240+
p = path.Join(fileEntity.RootPath(), dest)
241+
} else {
242+
p = path.Join(strings.Repeat("../", level), dest)
243+
}
238244
node.Tokens = []byte(p)
239245
} else {
240246
// 在工作空间内

0 commit comments

Comments
 (0)