func rewriteRelPaths()

in astro/config.go [198:224]


func rewriteRelPaths(root string, isCommand bool, relpaths ...*string) error {
	for _, path := range relpaths {
		if *path == "" {
			continue
		}

		if filepath.IsAbs(*path) {
			continue
		}

		// do not resolve commands that are not explicit relative paths (rewrites ./foo but not foo)
		if isCommand && shouldSearchExecutableInOSPath(*path) {
			continue
		}

		rootAbsPath, err := filepath.Abs(root)
		if err != nil {
			return err
		}

		newPath := filepath.Join(rootAbsPath, *path)
		logger.Trace.Printf("config: rewriting path \"%v\" to \"%v\"", *path, newPath)
		*path = newPath
	}

	return nil
}