I would like to create a FUSE file system which accepts any kind of write operation to any path inside the file system. Kind of like a named pipe, but in form of a directory.
echo test > bar # consumes "test"
echo test > bar/foo # consumes "test", even though the directory "bar" hasn't been created
echo test > x/y/z/test # consumes "test", even though the directories "x/y/z" haven't been created
I'm using bazil.org/fuse for the implementation. The problem that I'm facing is that when an application wants to write to foo/bar inside my file system, it checks whether foo is a directory, then whether bar is a file. Unfortunately, I can't know upfront whether foo should be a file or a directory.
My Attr function looks as follows:
func (d *Dir) Attr(ctx context.Context, a *fuse.Attr) error {
a.Inode = 1
a.Mode = os.ModeDir | 0755
}
This code is specific for a directory node type, due to os.ModeDir. I want this to work for directories or files.
Is there a way to achieve what I want?