cloudflaredPath pulls the full path of cloudflared on disk
()
| 517 | |
| 518 | // cloudflaredPath pulls the full path of cloudflared on disk |
| 519 | func cloudflaredPath() string { |
| 520 | path, err := os.Executable() |
| 521 | if err == nil && isFileThere(path) { |
| 522 | return path |
| 523 | } |
| 524 | |
| 525 | for _, p := range strings.Split(os.Getenv("PATH"), ":") { |
| 526 | path := fmt.Sprintf("%s/%s", p, "cloudflared") |
| 527 | if isFileThere(path) { |
| 528 | return path |
| 529 | } |
| 530 | } |
| 531 | return "cloudflared" |
| 532 | } |
| 533 | |
| 534 | // isFileThere will check for the presence of candidate path |
| 535 | func isFileThere(candidate string) bool { |
no test coverage detected