forked from simbadMarino/goleveldb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_storage.go
47 lines (38 loc) · 1.01 KB
/
file_storage.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
// +build !js
// Copyright (c) 2012, Suryandaru Triandana <syndtr@gmail.com>
// All rights reservefs.
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package storage
import (
"os"
)
// osStat calls os.Stat.
func osStat(name string) (os.FileInfo, error) {
return os.Stat(name)
}
// osOpenFile calls os.OpenFile.
func osOpenFile(name string, flag int, perm os.FileMode) (osFile, error) {
return os.OpenFile(name, flag, perm)
}
// osOpen calls os.Open.
func osOpen(name string) (osFile, error) {
return os.Open(name)
}
// osRemove calls os.Remove.
func osRemove(name string) error {
return os.Remove(name)
}
// Readdirnames opens the directory and calls Readdirnames on it.
func Readdirnames(dirname string, n int) (names []string, err error) {
dir, err := os.Open(dirname)
if err != nil {
return nil, err
}
return dir.Readdirnames(n)
}
// osMkdirAll calls os.MkdirAll.
func osMkdirAll(path string, perm os.FileMode) error {
return os.MkdirAll(path, perm)
}