2018-06-08 05:26:10 -04:00
|
|
|
// +build !linux
|
|
|
|
|
|
|
|
package fsutil
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
"time"
|
2020-11-17 05:31:07 -05:00
|
|
|
|
|
|
|
"github.com/pkg/errors"
|
2018-06-08 05:26:10 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
func chtimes(path string, un int64) error {
|
|
|
|
mtime := time.Unix(0, un)
|
2018-06-08 21:07:42 -04:00
|
|
|
fi, err := os.Lstat(path)
|
|
|
|
if err != nil {
|
2020-11-17 05:31:07 -05:00
|
|
|
return errors.WithStack(err)
|
2018-06-08 21:07:42 -04:00
|
|
|
}
|
|
|
|
if fi.Mode()&os.ModeSymlink != 0 {
|
|
|
|
return nil
|
|
|
|
}
|
2020-11-17 05:31:07 -05:00
|
|
|
return errors.WithStack(os.Chtimes(path, mtime, mtime))
|
2018-06-08 05:26:10 -04:00
|
|
|
}
|