MCPcopy
hub / github.com/runfinch/finch / FindFinch

Function FindFinch

pkg/path/finch_remote.go:88–101  ·  view source on GitHub ↗

FindFinch finds the installation path of Finch.

(deps FinchFinderDeps)

Source from the content-addressed store, hash-verified

86
87// FindFinch finds the installation path of Finch.
88func FindFinch(deps FinchFinderDeps) (Finch, error) {
89 exe, err := deps.Executable()
90 if err != nil {
91 return "", fmt.Errorf("failed to locate the executable that starts this process: %w", err)
92 }
93 realPath, err := deps.EvalSymlinks(exe)
94 if err != nil {
95 return "", fmt.Errorf("failed to find the real path of the executable: %w", err)
96 }
97 // The directory structure is finch_home/bin/finch,
98 // where the last path comment (i.e., finch) is the executable that starts this process.
99 res := deps.FilePathJoin(realPath, "..", "..")
100 return Finch(res), nil
101}

Callers 2

xmainFunction · 0.92
TestFindFinchFunction · 0.85

Calls 5

FinchTypeAlias · 0.70
ExecutableMethod · 0.65
ErrorfMethod · 0.65
EvalSymlinksMethod · 0.65
FilePathJoinMethod · 0.65

Tested by 1

TestFindFinchFunction · 0.68