isUnderManagedDir reports whether path resolves inside the managed dir.
(path string)
| 36 | |
| 37 | // isUnderManagedDir reports whether path resolves inside the managed dir. |
| 38 | func isUnderManagedDir(path string) bool { |
| 39 | dir := managedDir() |
| 40 | rel, err := filepath.Rel(dir, path) |
| 41 | if err != nil { |
| 42 | return false |
| 43 | } |
| 44 | return rel != ".." && !strings.HasPrefix(rel, ".."+string(filepath.Separator)) |
| 45 | } |
| 46 | |
| 47 | // TargetPath delegates to entities.InstructionPath to resolve the concrete |
| 48 | // install path for an instruction on a given app/level. |
no test coverage detected