Re: How to check whether directory tree has changed?

2019-12-21 Thread Sandor Szatmari via Cocoa-dev
> On Dec 21, 2019, at 13:43, Jens Alfke wrote: > >  > >> On Dec 21, 2019, at 10:18 AM, Gabriel Zachmann via Cocoa-dev >> wrote: >> >> Right. I was hoping there is an easy way to do this. >> Something like a recursive check sum over the whole directory tree that the >> OS might keep. >> I

Re: How to check whether directory tree has changed?

2019-12-21 Thread Jens Alfke via Cocoa-dev
> On Dec 21, 2019, at 10:18 AM, Gabriel Zachmann via Cocoa-dev > wrote: > > Right. I was hoping there is an easy way to do this. > Something like a recursive check sum over the whole directory tree that the > OS might keep. > I don't want to do a complete tree traversal every time the app

Re: How to check whether directory tree has changed?

2019-12-21 Thread Jim Crate via Cocoa-dev
You want the FSEvents API. I’m pretty sure you can specify the start time for the events, and subdirectories are included. My app specifically discards events before I start monitoring. Jim Crate > On Dec 21, 2019, at 11:09, Gabriel Zachmann via Cocoa-dev > wrote: > > Is there a quick and

Re: How to check whether directory tree has changed?

2019-12-21 Thread Allan Odgaard via Cocoa-dev
On 22 Dec 2019, at 1:18, Gabriel Zachmann wrote: Right. I was hoping there is an easy way to do this. There is the File System Events API: https://developer.apple.com/library/archive/documentation/Darwin/Conceptual/FSEvents_ProgGuide/Introduction/Introduction.html

Re: How to check whether directory tree has changed?

2019-12-21 Thread Gabriel Zachmann via Cocoa-dev
> Are you looking to detect changes that happen in between launches of your > app? If so you’d have to save state and compare that saved state to the dir > contents each time the app is launched. Right. I was hoping there is an easy way to do this. Something like a recursive check sum over

Re: How to check whether directory tree has changed?

2019-12-21 Thread Sandor Szatmari via Cocoa-dev
> On Dec 21, 2019, at 12:56, Gabriel Zachmann wrote: > >  > Thanks a lot! > > Does it really watch subfolders, too? The docs can answer this better I. > > Also, it seems to me like it works only while the program is running. > > I am mostly interested in changes that happen "behind the

Re: How to check whether directory tree has changed?

2019-12-21 Thread Gabriel Zachmann via Cocoa-dev
Thanks a lot! Does it really watch subfolders, too? Also, it seems to me like it works only while the program is running. I am mostly interested in changes that happen "behind the program's back", i.e., while it is *not* running. Does your code really handle that? Best regards, Gabriel >

Re: How to check whether directory tree has changed?

2019-12-21 Thread Sandor Szatmari via Cocoa-dev
I’ve used dispatch stuff. I found this with a quick google… it should be close to what one would need to monitor a folder. int fildes = open("/path/to/directory", O_RDONLY); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_source_t source =

How to check whether directory tree has changed?

2019-12-21 Thread Gabriel Zachmann via Cocoa-dev
Is there a quick and easy way to check whether or not a directory tree has changed? I am only interested in file additions or deletions, somewhere beneath a specific root directory, e.g., ~/Data/some_directory. However, I am interested in such changes between different invocations of my