开发者

Can a MacFUSE file system support "virtual" directories?

开发者 https://www.devze.com 2023-01-24 21:44 出处:网络
I\'m toying around with MacFUSE, and it\'s pretty neat. (I\'m using the Objective-C API.) I\'m currently trying to build a filesystem that allows files to be classified by tags. That is, I\'d take a

I'm toying around with MacFUSE, and it's pretty neat. (I'm using the Objective-C API.)

I'm currently trying to build a filesystem that allows files to be classified by tags. That is, I'd take a directory with a flat structure (and possibly lots of file), and moving a file into a directory would actually just attach a tag to it (without actually moving it). When entering this directory, you would see all files that have that tag. You could also further move into subdirectories, which would yield only file开发者_JAVA技巧s that have all tags.

Problem is that there could be lots of tags, and I don't really like listing "fake" directories for the tags (especially since it also means I need to provide attributes for them). However, it seems impossible to open files or directories that aren't listed by contentsOfDirectoryAtPath:error.

Am I missing some convenient delegate method, or do I really have to list the tag directories as well?


Turns out that what MacFuse really wanted was attributes for the folders, and my attributesOfItemAtPath:(NSString *)path userData:(id)userData error:(NSError **)error didn't give them any.

Giving the only mandatory attribute for folders (NSFileType: NSDirectoryFileType) seems to work "well enough". That is, the folders have a rather weak state of existence (anecdotal variations in the Finder causes the folder to "disappear" and the window to wind back to the file system root), but in the Terminal it works.

0

精彩评论

暂无评论...
验证码 换一张
取 消