zmugfs shows readonly (sub)categories

I kept fighting fuse.Direntry. When I tried:

for n in node.get_nodes():
     yield fuse.Direntry(n.path)

I would get NOTHING! but if I created a simple test list it would work:

f = ['foo', 'bar', 'path', 'cheese']
for i in f:
    yield fuse.Direntry(i)

It was confusing until I notice the only difference was that n.path was a unicode string while my test list were ascii stings. I thought to myself, “nah, that can’t be it”. But what do you know! I made this change:

yield fuse.Direntry(n.path.string('/').encode('ascii'))

Not sure if that will be the final code, IMO fuse.Direntry should work with unicode strings. But none the less, the result is a magnificent readonly view using ls and ls -l.

zmugfs shows ls


Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s