-
Notifications
You must be signed in to change notification settings - Fork 464
/
readonlysystem.go
60 lines (48 loc) · 1.44 KB
/
readonlysystem.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package chezmoi
import (
"io/fs"
vfs "github.com/twpayne/go-vfs/v5"
)
// A ReadOnlySystem is a system that may only be read from.
type ReadOnlySystem struct {
noUpdateSystemMixin
system System
}
// NewReadOnlySystem returns a new ReadOnlySystem that wraps system.
func NewReadOnlySystem(system System) *ReadOnlySystem {
return &ReadOnlySystem{
system: system,
}
}
// Glob implements System.Glob.
func (s *ReadOnlySystem) Glob(pattern string) ([]string, error) {
return s.system.Glob(pattern)
}
// Lstat implements System.Lstat.
func (s *ReadOnlySystem) Lstat(filename AbsPath) (fs.FileInfo, error) {
return s.system.Lstat(filename)
}
// RawPath implements System.RawPath.
func (s *ReadOnlySystem) RawPath(path AbsPath) (AbsPath, error) {
return s.system.RawPath(path)
}
// ReadDir implements System.ReadDir.
func (s *ReadOnlySystem) ReadDir(name AbsPath) ([]fs.DirEntry, error) {
return s.system.ReadDir(name)
}
// ReadFile implements System.ReadFile.
func (s *ReadOnlySystem) ReadFile(name AbsPath) ([]byte, error) {
return s.system.ReadFile(name)
}
// Readlink implements System.Readlink.
func (s *ReadOnlySystem) Readlink(name AbsPath) (string, error) {
return s.system.Readlink(name)
}
// Stat implements System.Stat.
func (s *ReadOnlySystem) Stat(name AbsPath) (fs.FileInfo, error) {
return s.system.Stat(name)
}
// UnderlyingFS implements System.UnderlyingFS.
func (s *ReadOnlySystem) UnderlyingFS() vfs.FS {
return s.system.UnderlyingFS()
}