Notifications for file system changed?

£可爱£侵袭症+ 提交于 2020-02-20 09:29:46

问题


I'm implementing a free space on disk bar where while files are being copied, the free space bar updates. I need some way of being notified of file system changes. What's the best way to go about doing this?


回答1:


The File System Events Programming Guide has all the info you need. You want to register with the File System Events API (OS X 10.5 and later).




回答2:


To monitor operations on individual files you can use kqueue file change notifications. Uli Kusterer has a nice Obj-C wrapper called UKKQueue.

You can get it here: http://zathras.de/angelweb/sourcecode.htm

If you want to watch an entire folder, FSEvents (and the SCEvents wrapper) will probably be of more use.



来源:https://stackoverflow.com/questions/1501119/notifications-for-file-system-changed

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