Skip to content

Conversation

@dinocore1
Copy link
Contributor

I am trying to implement a subclass of AbstractFuseFilesystem and need to be able to return error codes. For example:

protected synchronized int readdir(String path, StructFuseFileInfo info, DirectoryFiller filler) {
        if(!mVirtualFS.pathExists(path)) {
            return -ErrorCodes.ENOENT();
        }

@pron
Copy link
Contributor

pron commented Aug 22, 2016

May I ask why do you need to subclass AbstractFuseFilesystem? It kind of goes against the whole spirit of this project, which attempts to hide FUSE altogether, instead exposing only Java's FileSystem as the only API.

@dinocore1
Copy link
Contributor Author

It wasn't obvious how to get started with the Java FileSystem API. Is there any example code on how to use the JavaFS + the FileSystem API? It seemed more straight forward to subclass AbstractFuseFilesystem. Also, I'm not sure yet, but my project might require this kind of low-level and fine control.

I would be happy to add some documentation to the README.md

@pron
Copy link
Contributor

pron commented Aug 22, 2016

The entire documentation is there, and that's the whole point of the project :)

JavaFS has only two API methods: JavaFS.mount and JavaFS.unmount. The FileSystem API/SPI is fully documented in the Java documentation. For a direct FUSE API, consider using one of the alternative projects listed in README.

@pron
Copy link
Contributor

pron commented Aug 22, 2016

In other words, you don't return an error code, but throw an appropriate exception.

@dinocore1
Copy link
Contributor Author

Ah I see. I actually started by using jnr-fuse but it did not have support for Mac OSX. JavaFS's Mac OSX supports works perfectly, that why I chose to use it.

@pron
Copy link
Contributor

pron commented Aug 22, 2016

The FileSystemProvider SPI is actually quite good and quite portable. If it's good enough for your needs, then this is the project for you. You can find implementations for a ZIP file system and an in-memory file system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants