-
Notifications
You must be signed in to change notification settings - Fork 0
/
osfs.go
80 lines (60 loc) · 1.66 KB
/
osfs.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
package gofs
import "os"
import "path/filepath"
type osFilesystem struct {
}
// OsFs creates an OS-based FileSystem.
func OsFs() FileSystem {
return osFilesystem{}
}
func (osFilesystem) Stat(name string) (os.FileInfo, error) {
return os.Stat(name)
}
func (osFilesystem) Getwd() (string, error) {
return os.Getwd()
}
func (osFilesystem) Chdir(dir string) error {
return os.Chdir(dir)
}
func (osFilesystem) Abs(path string) (string, error) {
return filepath.Abs(path)
}
func (osFilesystem) Chmod(name string, mode os.FileMode) error {
return os.Chmod(name, mode)
}
func (osFilesystem) Lstat(name string) (os.FileInfo, error) {
return os.Lstat(name)
}
func (osFilesystem) Readlink(name string) (string, error) {
return os.Readlink(name)
}
func (osFilesystem) Symlink(oldname, newname string) error {
return os.Symlink(oldname, newname)
}
func (osFilesystem) Open(name string) (File, error) {
return os.Open(name)
}
func (osFilesystem) Create(name string) (File, error) {
return os.Create(name)
}
func (osFilesystem) OpenFile(name string, flag int, perm os.FileMode) (File, error) {
return os.OpenFile(name, flag, perm)
}
func (osFilesystem) Mkdir(path string, perm os.FileMode) error {
return os.Mkdir(path, perm)
}
func (osFilesystem) MkdirAll(path string, perm os.FileMode) error {
return os.MkdirAll(path, perm)
}
func (osFilesystem) Truncate(name string, size int64) error {
return os.Truncate(name, size)
}
func (osFilesystem) Remove(name string) error {
return os.Remove(name)
}
func (osFilesystem) RemoveAll(path string) error {
return os.RemoveAll(path)
}
func (osFilesystem) Rename(oldpath, newpath string) error {
return os.Rename(oldpath, newpath)
}