Skip to content

Commit

Permalink
chore: make FastAbs comment more easy to understand (#6692)
Browse files Browse the repository at this point in the history
  • Loading branch information
WeidiDeng authored Nov 15, 2024
1 parent 37f0c4b commit 6028ff2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions filepath.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions filepath_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

0 comments on commit 6028ff2

Please sign in to comment.