是否有一个好的 objc 库包装器用于文件系统事件/kqueue 来为我处理递归监视?
我想编写一个 OSX(雪豹)应用程序,当特定目录中的文件发生更改时,该应用程序会收到通知,并且我想访问已更改的特定文件的路径。
我知道我可以使用文件系统事件
或kqueue
来做到这一点。前者不提供更改的特定文件的详细信息(要求我构建我正在监视的目录的快照,然后扫描它以找出更改的文件)。后者不支持递归监视(要求我递归地将监视添加到父目录中的每个文件和目录)。
我已经寻找过为我处理快照/递归乐趣的库,但找不到任何库。 UKKQueue
看起来像是低级 kqueue
内容的一个很好的包装器,但似乎没有进行递归。与 GTMFileSystemKQueue 相同。 SCEvents
看起来像是一个很好的文件系统事件
包装器,但似乎无法找出发生更改的特定文件。
是否有一个库可以满足我的需求并且适合这些技术的 objc 项目?
I want to write an OSX (Snow Leopard) app that receives notifications when files within a specific directory are changed, and I want access to the path of the specific file that was changed.
I know I can do this using either File System Events
or kqueue
. The former doesn't provide the details of which specific file changed (requiring me to build a snapshot of the directory I'm watching and then scan it to find out which file changed). The latter doesn't support recursive watching (requiring me to recursively add watches to every file and directory within the parent directory).
I've had a look for libraries that handle the snapshot/recursion fun for me, but can't find any. UKKQueue
looks like a good wrapper for the low level kqueue
stuff, but doesn't seem to do recursion. Same for GTMFileSystemKQueue
. SCEvents
looks like a good wrapper for File System Events
but doesn't seem to handle finding out the specific file that changed.
Is there a library that does what I want and is suitable for an objc project for either of these technologies?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我最终使用了
GTMFileSystemKQueue
在我发现递归迭代 objc 中的目录是多么容易之后:I ended up using
GTMFileSystemKQueue
after I found out how easy it is to recursively iterate over a directory in objc: