Skip to content

Commit

Permalink
feat: linkfile mtime.
Browse files Browse the repository at this point in the history
  • Loading branch information
cody committed Dec 6, 2024
1 parent 172ed5a commit a5e0cab
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions linkfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ type Symlink struct {
Target string

mtime time.Time
stat os.FileInfo
reader strings.Reader
}

func NewLinkFile(target string, stat os.FileInfo) File {
lf := &Symlink{Target: target, stat: stat}
if stat.ModTime() != (time.Time{}) {
lf.mtime = stat.ModTime()
mtime := time.Time{}
if stat != nil {
mtime = stat.ModTime()
}
return NewSymlinkFile(target, mtime)
}

func NewSymlinkFile(target string, mtime time.Time) File {
lf := &Symlink{
Target: target,
mtime: mtime,
}
lf.reader.Reset(lf.Target)
return lf
Expand Down

0 comments on commit a5e0cab

Please sign in to comment.