Abs returns an absolute representation of path, but handles case-insensitive filesystems as described in the comment on Getwd for the case where the path is relative and the cwd needs to be obtained
(path string)
| 169 | // Abs returns an absolute representation of path, but handles case-insensitive filesystems as described in the comment |
| 170 | // on Getwd for the case where the path is relative and the cwd needs to be obtained |
| 171 | func Abs(path string) (string, error) { |
| 172 | if runtime.GOOS != "darwin" { |
| 173 | return filepath.Abs(path) |
| 174 | } |
| 175 | |
| 176 | if filepath.IsAbs(path) { |
| 177 | return filepath.Clean(path), nil |
| 178 | } |
| 179 | cwd, err := Getwd() |
| 180 | if err != nil { |
| 181 | return "", err |
| 182 | } |
| 183 | return filepath.Join(cwd, path), nil |
| 184 | } |
no test coverage detected