From 0d3180271bbf6164755edd8ed9994337cb20c5f8 Mon Sep 17 00:00:00 2001 From: morpingsss Date: Mon, 29 Jul 2024 10:52:10 +0800 Subject: [PATCH] feat(llgo/chore/llcppg): add JSONPath --- chore/_xtool/llcppsymg/llcppsymg.go | 10 +++++++++- chore/llcppg/types/types.go | 1 + 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/chore/_xtool/llcppsymg/llcppsymg.go b/chore/_xtool/llcppsymg/llcppsymg.go index 0597e6a6..03614a9b 100644 --- a/chore/_xtool/llcppsymg/llcppsymg.go +++ b/chore/_xtool/llcppsymg/llcppsymg.go @@ -64,11 +64,19 @@ func main() { jsonData, err := json.MarshalIndent(symbolInfo, "", " ") check(err) - // 写入文件 fileName := "llcppg.symb.json" err = os.WriteFile(fileName, jsonData, 0644) check(err) + absJSONPath, err := filepath.Abs(fileName) + check(err) + + config.JSONPath = absJSONPath + updatedCfgData, err := json.MarshalIndent(config, "", " ") + check(err) + + err = os.WriteFile(cfgFile, updatedCfgData, 0644) + check(err) } func check(err error) { diff --git a/chore/llcppg/types/types.go b/chore/llcppg/types/types.go index 2e39bbdd..91ac3a5b 100644 --- a/chore/llcppg/types/types.go +++ b/chore/llcppg/types/types.go @@ -23,4 +23,5 @@ type Config struct { Libs string `json:"libs"` Include []string `json:"include"` TrimPrefixes []string `json:"trimPrefixes"` + JSONPath string `json:"jsonPath"` }