ResolveIncludePath resolves include path based on workflowspec format or relative path
(filePath, baseDir string, cache *ImportCache)
| 196 | |
| 197 | // ResolveIncludePath resolves include path based on workflowspec format or relative path |
| 198 | func ResolveIncludePath(filePath, baseDir string, cache *ImportCache) (string, error) { |
| 199 | remoteLog.Printf("Resolving include path: file_path=%s, base_dir=%s", filePath, baseDir) |
| 200 | |
| 201 | if builtinPath, handled, err := resolveBuiltinIncludePath(filePath); handled { |
| 202 | return builtinPath, err |
| 203 | } |
| 204 | |
| 205 | if isWorkflowSpec(filePath) { |
| 206 | remoteLog.Printf("Detected workflowspec format: %s", filePath) |
| 207 | return downloadIncludeFromWorkflowSpec(filePath, cache) |
| 208 | } |
| 209 | |
| 210 | remoteLog.Printf("Using local file resolution for: %s", filePath) |
| 211 | resolveBase, securityBase, normalizedFilePath := computeIncludeResolveAndSecurityBases(filePath, baseDir) |
| 212 | return resolveAndValidateLocalIncludePath(normalizedFilePath, resolveBase, securityBase) |
| 213 | } |
| 214 | |
| 215 | func resolveBuiltinIncludePath(filePath string) (string, bool, error) { |
| 216 | if !strings.HasPrefix(filePath, BuiltinPathPrefix) { |