ResolveDir returns an absolute path to the directory that the task should be run in. If the entrypoint and dir are BOTH set, then the Taskfile will not sit inside the directory specified by dir and we should ensure that the dir is absolute. Otherwise, the dir will always be the parent directory of t
(entrypoint, resolvedEntrypoint, dir string)
| 43 | // is absolute. Otherwise, the dir will always be the parent directory of the |
| 44 | // resolved entrypoint, so we should return that parent directory. |
| 45 | func ResolveDir(entrypoint, resolvedEntrypoint, dir string) (string, error) { |
| 46 | if entrypoint != "" && dir != "" { |
| 47 | return filepath.Abs(dir) |
| 48 | } |
| 49 | return filepath.Dir(resolvedEntrypoint), nil |
| 50 | } |
| 51 | |
| 52 | // Search looks for files with the given possible filenames using the given |
| 53 | // entrypoint and directory. If the entrypoint is set, it checks if the |
searching dependent graphs…