Beispiel #1
0
func (fs *Filespace) Filespace(subPath string) (filesystem.Filespace, error) {
	node, err := fs.root.GetByPath(subPath)
	if err != nil {
		return nil, err
	}
	if !node.IsDir() {
		return nil, fmt.Errorf("Path is not a directory " + subPath)
	}
	return filesystem.Filespace(&Filespace{
		root: node.(*Dir),
	}), nil
}
Beispiel #2
0
// NewFilespace create new Filespace instance
func NewFilespace(path string) (filesystem.Filespace, error) {
	varutil.FixDirPath(&path)
	return filesystem.Filespace(&Filespace{
		path: path,
	}), nil
}