Skip to content

Commit d4be297

Browse files
committed
Added Lstat function
1 parent b3ef88d commit d4be297

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
"io/ioutil"
3637
"os"
3738
"path/filepath"
@@ -70,10 +71,18 @@ func NewFromFile(file *os.File) *Path {
7071
// Stat returns a FileInfo describing the named file. The result is
7172
// cached internally for next queries. To ensure that the cached
7273
// FileInfo entry is updated just call Stat again.
73-
func (p *Path) Stat() (os.FileInfo, error) {
74+
func (p *Path) Stat() (fs.FileInfo, error) {
7475
return os.Stat(p.path)
7576
}
7677

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

0 commit comments

Comments
 (0)