diff options
Diffstat (limited to 'object/fetch/treefs_path.go')
| -rw-r--r-- | object/fetch/treefs_path.go | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/object/fetch/treefs_path.go b/object/fetch/treefs_path.go new file mode 100644 index 00000000..7aa31c7f --- /dev/null +++ b/object/fetch/treefs_path.go @@ -0,0 +1,29 @@ +package fetch + +import ( + "io/fs" + "strings" +) + +func treeFSValidPath(name string) bool { + return name == "." || fs.ValidPath(name) +} + +func treeFSSplitPath(name string) [][]byte { + if name == "." { + return nil + } + + parts := strings.Split(name, "/") + + out := make([][]byte, len(parts)) + for i, part := range parts { + out[i] = []byte(part) + } + + return out +} + +func treeFSPathError(op treeFSOp, path string, err error) error { + return &fs.PathError{Op: op.pathErrorOp(), Path: path, Err: err} +} |
