MCPcopy Create free account
hub / github.com/SeeFlowerX/stackplz / addLibPath

Function addLibPath

cli/cmd/root.go:451–484  ·  view source on GitHub ↗
(name string)

Source from the content-addressed store, hash-verified

449}
450
451func addLibPath(name string) {
452 content, err := util.RunCommand("pm", "path", name)
453 if err != nil {
454 panic(err)
455 }
456 for _, line := range strings.Split(content, "\n") {
457 parts := strings.Split(line, ":")
458 if len(parts) == 2 {
459 // 将 apk 文件也作为搜索路径
460 apk_path := parts[1]
461 _, err := os.Stat(apk_path)
462 if err == nil {
463 if !slices.Contains(gconfig.LibraryDirs, apk_path) {
464 if gconfig.Debug {
465 mconfig.GetLogger().Printf("add lib_search_path => [%s]", apk_path)
466 }
467 gconfig.LibraryDirs = append(gconfig.LibraryDirs, apk_path)
468 }
469 }
470 // 将 apk + /lib/arm64 作为搜索路径
471 items := strings.Split(parts[1], "/")
472 lib_search_path := strings.Join(items[:len(items)-1], "/") + "/lib/arm64"
473 _, err = os.Stat(lib_search_path)
474 if err == nil {
475 if !slices.Contains(gconfig.LibraryDirs, lib_search_path) {
476 if gconfig.Debug {
477 mconfig.GetLogger().Printf("add lib_search_path => [%s]", lib_search_path)
478 }
479 gconfig.LibraryDirs = append(gconfig.LibraryDirs, lib_search_path)
480 }
481 }
482 }
483 }
484}
485
486func findBTFAssets() string {
487 var utsname syscall.Utsname

Callers 1

persistentPreRunEFuncFunction · 0.85

Calls 2

RunCommandFunction · 0.92
GetLoggerMethod · 0.45

Tested by

no test coverage detected