Skip to content

Commit f6afd8b

Browse files
committed
Added Lstat function
1 parent dcc3db3 commit f6afd8b

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Diff for: paths.go

+10-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ package paths
3232
import (
3333
"fmt"
3434
"io"
35+
"io/fs"
3536
"os"
3637
"path/filepath"
3738
"strings"
@@ -69,10 +70,18 @@ func NewFromFile(file *os.File) *Path {
6970
// Stat returns a FileInfo describing the named file. The result is
7071
// cached internally for next queries. To ensure that the cached
7172
// FileInfo entry is updated just call Stat again.
72-
func (p *Path) Stat() (os.FileInfo, error) {
73+
func (p *Path) Stat() (fs.FileInfo, error) {
7374
return os.Stat(p.path)
7475
}
7576

77+
// Lstat returns a FileInfo describing the named file. If the file is
78+
// a symbolic link, the returned FileInfo describes the symbolic link.
79+
// Lstat makes no attempt to follow the link. If there is an error, it
80+
// will be of type *PathError.
81+
func (p *Path) Lstat() (fs.FileInfo, error) {
82+
return os.Lstat(p.path)
83+
}
84+
7685
// Clone create a copy of the Path object
7786
func (p *Path) Clone() *Path {
7887
return New(p.path)

0 commit comments

Comments
 (0)