9
9
"runtime"
10
10
11
11
"github.com/lima-vm/lima/pkg/limayaml"
12
+ "github.com/sirupsen/logrus"
12
13
)
13
14
14
15
func Dir () (string , error ) {
@@ -36,7 +37,6 @@ func Dir() (string, error) {
36
37
// self: /usr/local/bin/limactl
37
38
selfDir := filepath .Dir (self )
38
39
selfDirDir := filepath .Dir (selfDir )
39
- selfDirDirDir := filepath .Dir (selfDirDir )
40
40
gaCandidates := []string {
41
41
// candidate 0:
42
42
// - self: /Applications/Lima.app/Contents/MacOS/limactl
@@ -48,12 +48,16 @@ func Dir() (string, error) {
48
48
// - agent: /usr/local/share/lima/lima-guestagent.Linux-x86_64
49
49
// - dir: /usr/local/share/lima
50
50
filepath .Join (selfDirDir , "share/lima/lima-guestagent." + ostype + "-" + arch ),
51
+ // TODO: support custom path
52
+ }
53
+ if logrus .GetLevel () == logrus .DebugLevel {
51
54
// candidate 2: lauched by `~/go/bin/dlv dap`
52
55
// - self: ${workspaceFolder}/cmd/limactl/__debug_bin_XXXXXX
53
56
// - agent: ${workspaceFolder}/_output/share/lima/lima-guestagent.Linux-x86_64
54
57
// - dir: ${workspaceFolder}/_output/share/lima
55
- filepath .Join (selfDirDirDir , "_output/share/lima/lima-guestagent." + ostype + "-" + arch ),
56
- // TODO: support custom path
58
+ candidateForDebugBuild := filepath .Join (filepath .Dir (selfDirDir ), "_output/share/lima/lima-guestagent." + ostype + "-" + arch )
59
+ gaCandidates = append (gaCandidates , candidateForDebugBuild )
60
+ logrus .Infof ("debug build detected, adding more guest agent candidates: %v" , candidateForDebugBuild )
57
61
}
58
62
for _ , gaCandidate := range gaCandidates {
59
63
if _ , err := os .Stat (gaCandidate ); err == nil {
0 commit comments