summaryrefslogtreecommitdiff
path: root/unix.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-22 17:19:29 -0600
committerJeff Carr <[email protected]>2024-02-22 17:19:29 -0600
commit359ebce26ee2223fdd05e8a04f75f15415ec0457 (patch)
treeaa2e82ec577d9abed0acb9138a43c13d40b76caa /unix.go
parentcd5f1d9d0f52196d6ea07684a4307369893911bd (diff)
mtime
Diffstat (limited to 'unix.go')
-rw-r--r--unix.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/unix.go b/unix.go
index 7d43d54..12ed300 100644
--- a/unix.go
+++ b/unix.go
@@ -233,6 +233,16 @@ func (rs *RepoStatus) Exists(filename string) bool {
return false
}
+func (rs *RepoStatus) mtime(filename string) (time.Time, error) {
+ pathf := filepath.Join(rs.Path(), filename)
+ statf, err := os.Stat(pathf)
+ if err == nil {
+ return statf.ModTime(), nil
+ }
+ log.Log(REPOWARN, "mtime() error", pathf, err)
+ return time.Now(), err
+}
+
// returns true if the file exists
func Exists(file string) bool {
_, err := os.Stat(file)