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
progra
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 = dispa
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
> I’ve
> 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 pro
> 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 the
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
__
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
> 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 la
> 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