FastAbs is an optimized version of filepath.Abs for Unix systems, since we don't expect the working directory to ever change once Caddy is running. Avoid the os.Getwd syscall overhead.
(path string)
| 29 | // since we don't expect the working directory to ever change once |
| 30 | // Caddy is running. Avoid the os.Getwd syscall overhead. |
| 31 | func FastAbs(path string) (string, error) { |
| 32 | if filepath.IsAbs(path) { |
| 33 | return filepath.Clean(path), nil |
| 34 | } |
| 35 | |
| 36 | if wderr != nil { |
| 37 | return "", wderr |
| 38 | } |
| 39 | |
| 40 | return filepath.Join(wd, path), nil |
| 41 | } |
no outgoing calls