mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-16 21:56:40 -05:00
chore: make FastAbs comment more easy to understand (#6692)
This commit is contained in:
parent
37f0c4bfae
commit
6028ff27fa
2 changed files with 6 additions and 2 deletions
|
@ -24,6 +24,8 @@ import (
|
|||
// 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.
|
||||
// It's overall the same as stdlib's implementation, the difference
|
||||
// being cached working directory.
|
||||
func FastAbs(path string) (string, error) {
|
||||
if filepath.IsAbs(path) {
|
||||
return filepath.Clean(path), nil
|
||||
|
|
|
@ -18,8 +18,10 @@ import (
|
|||
"path/filepath"
|
||||
)
|
||||
|
||||
// FastAbs can't be optimized on Windows because the
|
||||
// syscall.FullPath function takes an input.
|
||||
// FastAbs can't be optimized on Windows because there
|
||||
// are special file paths that require the use of syscall.FullPath
|
||||
// to handle correctly.
|
||||
// Just call stdlib's implementation which uses that function.
|
||||
func FastAbs(path string) (string, error) {
|
||||
return filepath.Abs(path)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue