zantoku / google-toolbox-for-mac

Automatically exported from code.google.com/p/google-toolbox-for-mac
Apache License 2.0
0 stars 0 forks source link

GTMFileSystemKQueue information and recursion #88

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using the GTMFileSystemKQueue class to implement a file system watcher for 
Mac, like I have on Windows.  I added this function to the GTMFileSystemKQueue 
class and use it as my callback:
[code]+ (void)callbackForQueue:(GTMFileSystemKQueue *)queue
                  events:(GTMFileSystemKQueueEvents)event
{
     NSLog(@"%@ changed", queue.path);
}[/code]

It works, but there are two limitations:
1.  It only prints out that the directory changed.  It doesn't tell me which 
file changed, or whether it was created, modified, or deleted.

2.  It does not work recursively.  Changes to files in folders below the 
directory passed to InitWithPath have no effect.

How can I make this code act recursively and provide the precise information I 
need?  Thank you.

Mac Developer forum thread here:
https://devforums.apple.com/thread/171514

Original issue reported on code.google.com by joshkl...@me.com on 26 Oct 2012 at 11:18

GoogleCodeExporter commented 9 years ago
This is just a wrapper for kevent: 
https://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages
/man2/kevent.2.html

kevent is for watch a path, not a directory tree.

The system provided FSEventStream apis is probably closer to what you want.

Original comment by thomasvl@google.com on 27 Oct 2012 at 6:38