Create creates a new file in the receiver directory.
( ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse, )
| 250 | |
| 251 | // Create creates a new file in the receiver directory. |
| 252 | func (n *Node) Create( |
| 253 | ctx context.Context, req *fuse.CreateRequest, resp *fuse.CreateResponse, |
| 254 | ) (fs.Node, fs.Handle, error) { |
| 255 | if !n.isDir() { |
| 256 | return nil, nil, fuse.Errno(syscall.ENOTDIR) |
| 257 | } |
| 258 | if req.Mode.IsDir() { |
| 259 | return nil, nil, fuse.Errno(syscall.EISDIR) |
| 260 | } else if !req.Mode.IsRegular() { |
| 261 | return nil, nil, fuse.Errno(syscall.EINVAL) |
| 262 | } |
| 263 | |
| 264 | node := n.cfs.newFileNode() |
| 265 | err := n.cfs.create(ctx, n.ID, req.Name, node) |
| 266 | if err != nil { |
| 267 | return nil, nil, err |
| 268 | } |
| 269 | return node, node, nil |
| 270 | } |
| 271 | |
| 272 | // Remove may be unlink or rmdir. |
| 273 | func (n *Node) Remove(ctx context.Context, req *fuse.RemoveRequest) error { |
nothing calls this directly
no test coverage detected