ValidateAbsolutePath ensures a field carries an absolute filesystem path.
(prefix string, field string, value string)
| 93 | |
| 94 | // ValidateAbsolutePath ensures a field carries an absolute filesystem path. |
| 95 | func validateAbsolutePathInternal(prefix string, field string, value string) error { |
| 96 | trimmed := strings.TrimSpace(value) |
| 97 | if trimmed == "" { |
| 98 | return prefixedError(prefix, field+" is required") |
| 99 | } |
| 100 | if !filepath.IsAbs(trimmed) { |
| 101 | return prefixedError(prefix, field+" must be an absolute path") |
| 102 | } |
| 103 | return nil |
| 104 | } |
| 105 | |
| 106 | // ValidateAbsolutePaths ensures every populated entry in a list is absolute. |
| 107 | func validateAbsolutePathsInternal(prefix string, field string, values []string) error { |