OSXFuse-如何在Finder中区分打开的文件和预览 [英] OSXFuse - How to distinguish open file from preview in Finder
问题描述
我正在使用 OSXFuse
并且想知道我是否可以区分以下操作:
And wanted to know if I can tell apart the following operations:
- 文件由用户打开
- 文件在Finder中预览
我的问题是,在两种情况下,都调用了readFileAtPath
,而且它们似乎具有相同的参数.
My problem is that for both cases readFileAtPath
is called, and seemingly with the same parameters.
推荐答案
显然,这不能使用简单的API来完成,因为无论谁请求,都会读取read.
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.
使用Fuse的C api,您可以fuse_get_context()
,并获取pid
,并从中获取进程名称.不需要更多.
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.
这篇关于OSXFuse-如何在Finder中区分打开的文件和预览的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!