i want to run the memoryfs example in the fuse-jna, but when i call rename it says no such file and i can't rename a file. i have found a bug in rename
public int rename(final String path, final String newName)
{
final MemoryPath p = getPath(path);
if (p == null) {
return -ErrorCodes.ENOENT;
}
final MemoryPath newParent = getParentPath(newName);
if (newParent != null) {
return -ErrorCodes.ENOENT;
}
if (!(newParent instanceof MemoryDirectory)) {
return -ErrorCodes.ENOTDIR;
}
p.delete();
((MemoryDirectory) newParent).add(p);
return 0;
}
the ! should be = in
if (newParent != null) {
return -ErrorCodes.ENOENT;
}
now i can move a file correctly but i just can't rename, is there a bug in the example? and what should i do to make it right? thanks a lot!
i notice that the latest version works fine. and the rename is correct!