Work in progress
This commit is contained in:
parent
c5cf3d7805
commit
772019c4a2
14
dir.go
14
dir.go
@ -49,12 +49,13 @@ func newVersionedDir(node *versionedNode, inode uint64, parent *versionedDir) *v
|
|||||||
|
|
||||||
func (this *versionedDir) createDir(name string) (*versionedDir, error) {
|
func (this *versionedDir) createDir(name string) (*versionedDir, error) {
|
||||||
childPath := path.Join(this.node.path, name)
|
childPath := path.Join(this.node.path, name)
|
||||||
|
childPathFull := this.node.ver.rebasePath(childPath)
|
||||||
|
|
||||||
if err := os.Mkdir(childPath, 0755); err != nil {
|
if err := os.Mkdir(childPathFull, 0755); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
info, err := os.Stat(childPath)
|
info, err := os.Stat(childPathFull)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -65,14 +66,15 @@ func (this *versionedDir) createDir(name string) (*versionedDir, error) {
|
|||||||
|
|
||||||
func (this *versionedDir) createFile(name string, flags int) (*versionedFile, error) {
|
func (this *versionedDir) createFile(name string, flags int) (*versionedFile, error) {
|
||||||
childPath := path.Join(this.node.path, name)
|
childPath := path.Join(this.node.path, name)
|
||||||
|
childPathFull := this.node.ver.rebasePath(childPath)
|
||||||
|
|
||||||
file, err := os.OpenFile(name, flags, 0644)
|
file, err := os.OpenFile(childPathFull, flags, 0644)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
defer file.Close()
|
defer file.Close()
|
||||||
|
|
||||||
info, err := os.Stat(childPath)
|
info, err := os.Stat(childPathFull)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -104,6 +106,10 @@ func (this *versionedDir) Create(ctx context.Context, req *fuse.CreateRequest, r
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *versionedDir) Mkdir(ctx context.Context, req *fuse.MkdirRequest) (fs.Node, error) {
|
||||||
|
return this.createDir(req.Name)
|
||||||
|
}
|
||||||
|
|
||||||
func (this *versionedDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
func (this *versionedDir) ReadDirAll(ctx context.Context) ([]fuse.Dirent, error) {
|
||||||
entries := []fuse.Dirent{{Inode: this.inode, Name: ".", Type: fuse.DT_Dir}}
|
entries := []fuse.Dirent{{Inode: this.inode, Name: ".", Type: fuse.DT_Dir}}
|
||||||
if this.parent != nil {
|
if this.parent != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user