shithub: furgit

ref: 1556cfb51d980ae8c5bf664ad69f3abd46f02386
dir: /object/resolve/treefs_path.go/

View raw version
package resolve

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}
}