javafs
javafs copied to clipboard
Make ErrorCodes publicly accessable
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();
}
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.
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
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.
In other words, you don't return an error code, but throw an appropriate exception.
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.
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.