Skip to content

Commit

Permalink
Merge pull request #28 from arduino/add-lstat
Browse files Browse the repository at this point in the history
Added Lstat method
  • Loading branch information
cmaglie authored Jan 12, 2024
2 parents dcc3db3 + f6afd8b commit 3226a11
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion paths.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ package paths
import (
"fmt"
"io"
"io/fs"
"os"
"path/filepath"
"strings"
Expand Down Expand Up @@ -69,10 +70,18 @@ func NewFromFile(file *os.File) *Path {
// Stat returns a FileInfo describing the named file. The result is
// cached internally for next queries. To ensure that the cached
// FileInfo entry is updated just call Stat again.
func (p *Path) Stat() (os.FileInfo, error) {
func (p *Path) Stat() (fs.FileInfo, error) {
return os.Stat(p.path)
}

// Lstat returns a FileInfo describing the named file. If the file is
// a symbolic link, the returned FileInfo describes the symbolic link.
// Lstat makes no attempt to follow the link. If there is an error, it
// will be of type *PathError.
func (p *Path) Lstat() (fs.FileInfo, error) {
return os.Lstat(p.path)
}

// Clone create a copy of the Path object
func (p *Path) Clone() *Path {
return New(p.path)
Expand Down

0 comments on commit 3226a11

Please sign in to comment.