MCPcopy
hub / github.com/go-task/task / ResolveDir

Function ResolveDir

internal/fsext/fs.go:45–50  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

43// is absolute. Otherwise, the dir will always be the parent directory of the
44// resolved entrypoint, so we should return that parent directory.
45func 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

Callers 2

NewFileNodeFunction · 0.92
TestResolveDirFunction · 0.85

Calls 1

DirMethod · 0.65

Tested by 1

TestResolveDirFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…