OSXFuse - How to distinguish open file from preview in Finder

心不动则不痛 提交于 2019-12-11 09:15:11

问题


I'm using OSXFuse

https://osxfuse.github.io/

And wanted to know if I can tell apart the following operations:

  • File is opened by the user
  • File is previewed in Finder

My problem is that for both cases readFileAtPath is called, and seemingly with the same parameters.


回答1:


Apparently this cannot be done using the simple API, as read is read no matter who requests it.

But that's the point, if you could identify who requested to read, you could block it for some processes.

Using Fuse's C api, you could you fuse_get_context(), and get the pid, and from it get the process name. No need for more.

See my question at Fuse Google Group.



来源:https://stackoverflow.com/questions/31912769/osxfuse-how-to-distinguish-open-file-from-preview-in-finder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!