github.com/Axway/agent-sdk@v1.1.101/pkg/cmd/service/daemon/filesystem.go (about)

     1  package daemon
     2  
     3  import (
     4  	"os"
     5  )
     6  
     7  // Created for testing purposes
     8  var fs fileSystem = osFS{}
     9  
    10  type fileSystem interface {
    11  	Stat(name string) (os.FileInfo, error)
    12  	Readlink(name string) (string, error)
    13  	Create(name string) (*os.File, error)
    14  	Remove(name string) error
    15  }
    16  
    17  // osFS implements fileSystem using the local disk.
    18  type osFS struct{}
    19  
    20  func (osFS) Stat(name string) (os.FileInfo, error) { return os.Stat(name) }
    21  func (osFS) Readlink(name string) (string, error)  { return os.Readlink(name) }
    22  func (osFS) Create(name string) (*os.File, error)  { return os.Create(name) }
    23  func (osFS) Remove(name string) error              { return os.Remove(name) }