Skip to content

Commit

Permalink
check for OS filesystems
Browse files Browse the repository at this point in the history
  • Loading branch information
mandelsoft committed Oct 14, 2024
1 parent 8bc9369 commit f20e8f3
Show file tree
Hide file tree
Showing 40 changed files with 2,010 additions and 5 deletions.
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
module github.com/mandelsoft/vfs

go 1.19
go 1.22.5

require (
github.com/mandelsoft/filepath v0.0.0-20240223090642-3e2777258aa3
github.com/modern-go/reflect2 v1.0.2
github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1
gopkg.in/yaml.v2 v2.3.0
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,10 @@ github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMyw
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/mandelsoft/filepath v0.0.0-20200909114706-3df73d378d55 h1:mFdiUG86O2iW+iDEpZKXf64efMWO4JvDT+zN3znUGIc=
github.com/mandelsoft/filepath v0.0.0-20200909114706-3df73d378d55/go.mod h1:n4xEiUD2HNHnn2w5ZKF0qgjDecHVCWAl5DxZ7+pcFU8=
github.com/mandelsoft/filepath v0.0.0-20230412200429-36b1eb66bd27 h1:VivN6K8H4H0G4bUmeQH68fQIROL5c8S2iyvVe4teufc=
github.com/mandelsoft/filepath v0.0.0-20230412200429-36b1eb66bd27/go.mod h1:LxhqC7khDoRENwooP6f/vWvia9ivj6TqLYrR39zqkN0=
github.com/mandelsoft/filepath v0.0.0-20240223090642-3e2777258aa3 h1:oo9nIgnyiBgYPbcZslRT4y29siuL5EoNJ/t1tr0xEVQ=
github.com/mandelsoft/filepath v0.0.0-20240223090642-3e2777258aa3/go.mod h1:LxhqC7khDoRENwooP6f/vWvia9ivj6TqLYrR39zqkN0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
Expand Down
20 changes: 20 additions & 0 deletions pkg/osfs/osfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,33 @@ import (
"time"

"github.com/mandelsoft/filepath/pkg/filepath"
"github.com/modern-go/reflect2"

"github.com/mandelsoft/vfs/pkg/utils"
"github.com/mandelsoft/vfs/pkg/vfs"
)

var OsFs = &osFileSystem{}

// OsFsCheck should be implemented by forwarding wrappers
// to check for an OS Filesystem implementation.
type OsFsCheck interface {
IsOsFileSystem() bool
}

func IsOsFileSystem(fs vfs.FileSystem) bool {
if reflect2.IsNil(fs) {
return false
}
if _, ok := fs.(*osFileSystem); ok {
return true
}
if c, ok := fs.(OsFsCheck); ok {
return c.IsOsFileSystem()
}
return false
}

type osFileSystem struct {
}

Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/modern-go/reflect2/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions vendor/github.com/modern-go/reflect2/.travis.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions vendor/github.com/modern-go/reflect2/Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions vendor/github.com/modern-go/reflect2/Gopkg.toml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

201 changes: 201 additions & 0 deletions vendor/github.com/modern-go/reflect2/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions vendor/github.com/modern-go/reflect2/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit f20e8f3

Please sign in to comment.