aboutsummaryrefslogtreecommitdiffstats
path: root/utils/fs/os.go
blob: 37ad75a3baa35669a47e64e549112daba195df04 (plain) (blame)
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
package fs

import (
	"io/ioutil"
	"os"
	"path/filepath"
)

// OS is a simple FS implementation for the current host filesystem.
type OS struct{}

// NewOS returns a new OS.
func NewOS() FS {
	return &OS{}
}

// Stat returns the filesystem info for a path.
func (o *OS) Stat(path string) (os.FileInfo, error) {
	return os.Stat(path)
}

// Open returns a ReadSeekCloser for the specified path.
func (o *OS) Open(path string) (ReadSeekCloser, error) {
	return os.Open(path)
}

// ReadDir returns the filesystem info for all the archives under the
// specified path.
func (o *OS) ReadDir(path string) ([]os.FileInfo, error) {
	return ioutil.ReadDir(path)
}

// Join joins the specified elements using the filesystem separator.
func (o *OS) Join(elem ...string) string {
	return filepath.Join(elem...)
}