fsRootAndFSRelPathForPath is a helper function that takes a path and returns the FS root and relative path to the FS root.
(path string)
| 851 | // fsRootAndFSRelPathForPath is a helper function that takes a path and returns the FS |
| 852 | // root and relative path to the FS root. |
| 853 | func fsRootAndFSRelPathForPath(path string) (string, string, error) { |
| 854 | absPath, err := normalpath.NormalizeAndAbsolute(path) |
| 855 | if err != nil { |
| 856 | return "", "", err |
| 857 | } |
| 858 | // Split the absolute path into components to get the FS root |
| 859 | absPathComponents := normalpath.Components(absPath) |
| 860 | fsRoot := absPathComponents[0] |
| 861 | fsRelPath, err := normalpath.Rel(fsRoot, absPath) |
| 862 | if err != nil { |
| 863 | return "", "", err |
| 864 | } |
| 865 | return fsRoot, fsRelPath, nil |
| 866 | } |
| 867 | |
| 868 | // We attempt to fix up paths we get back to better printing to the user. |
| 869 | // Without this, we'll get things like "stat: Users/foo/path/to/input: does not exist" |
no test coverage detected
searching dependent graphs…