mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-04-14 09:39:17 -04:00
isolate filesystem interface package
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package filesystem
|
||||
|
||||
import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/platform/filesystem/fsifce"
|
||||
"io"
|
||||
"os"
|
||||
|
||||
@@ -8,21 +9,15 @@ import (
|
||||
"github.com/v2fly/v2ray-core/v4/common/platform"
|
||||
)
|
||||
|
||||
type FileSeekerFunc func(path string) (io.ReadSeekCloser, error)
|
||||
|
||||
type FileReaderFunc func(path string) (io.ReadCloser, error)
|
||||
|
||||
type FileWriterFunc func(path string) (io.WriteCloser, error)
|
||||
|
||||
var NewFileSeeker FileSeekerFunc = func(path string) (io.ReadSeekCloser, error) {
|
||||
var NewFileSeeker fsifce.FileSeekerFunc = func(path string) (io.ReadSeekCloser, error) {
|
||||
return os.Open(path)
|
||||
}
|
||||
|
||||
var NewFileReader FileReaderFunc = func(path string) (io.ReadCloser, error) {
|
||||
var NewFileReader fsifce.FileReaderFunc = func(path string) (io.ReadCloser, error) {
|
||||
return os.Open(path)
|
||||
}
|
||||
|
||||
var NewFileWriter FileWriterFunc = func(path string) (io.WriteCloser, error) {
|
||||
var NewFileWriter fsifce.FileWriterFunc = func(path string) (io.WriteCloser, error) {
|
||||
return os.Create(path)
|
||||
}
|
||||
|
||||
|
||||
9
common/platform/filesystem/fsifce/ifce.go
Normal file
9
common/platform/filesystem/fsifce/ifce.go
Normal file
@@ -0,0 +1,9 @@
|
||||
package fsifce
|
||||
|
||||
import "io"
|
||||
|
||||
type FileSeekerFunc func(path string) (io.ReadSeekCloser, error)
|
||||
|
||||
type FileReaderFunc func(path string) (io.ReadCloser, error)
|
||||
|
||||
type FileWriterFunc func(path string) (io.WriteCloser, error)
|
||||
Reference in New Issue
Block a user