github.com/hanwen/go-fuse@v1.0.0/fuse/pathfs/loopback_darwin.go (about)

     1  // Copyright 2016 the Go-FUSE Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package pathfs
     6  
     7  import (
     8  	"syscall"
     9  	"time"
    10  
    11  	"github.com/hanwen/go-fuse/fuse"
    12  	"github.com/hanwen/go-fuse/internal/utimens"
    13  )
    14  
    15  func (fs *loopbackFileSystem) Utimens(path string, a *time.Time, m *time.Time, context *fuse.Context) fuse.Status {
    16  	// MacOS before High Sierra lacks utimensat() and UTIME_OMIT.
    17  	// We emulate using utimes() and extra GetAttr() calls.
    18  	var attr *fuse.Attr
    19  	if a == nil || m == nil {
    20  		var status fuse.Status
    21  		attr, status = fs.GetAttr(path, context)
    22  		if !status.Ok() {
    23  			return status
    24  		}
    25  	}
    26  	tv := utimens.Fill(a, m, attr)
    27  	err := syscall.Utimes(fs.GetPath(path), tv)
    28  	return fuse.ToStatus(err)
    29  }