Skip to content

Commit

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

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

func NewLinkFile(target string, stat os.FileInfo) File {
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 := &Symlink{Target: target, stat: stat}
if stat != nil && stat.ModTime() != (time.Time{}) {
lf.mtime = stat.ModTime()
}
lf.reader.Reset(lf.Target)
return lf
Expand Down

0 comments on commit b947f2e

Please sign in to comment.