Cocoa, FSEvents, kFSEventStreamCreateFlagFileEvents flag and “renamed” events

前端 未结 3 1387
逝去的感伤
逝去的感伤 2021-02-09 06:11

I\'ve been playing with FSEvents in a little application of mine to synchronize the content of my application with what\'s on the hard drive (basically, it\'s a lit

3条回答
  •  借酒劲吻你
    2021-02-09 07:01

    Since these events only deal with paths, you'll have to do some extra work to handle renames. One option is to track the inode numbers of the files you're interested in. So when you do that stat call, also note the inode number and see if it matches any files you're tracking.

    Be aware, though, that the OS may reuse the inode number of a deleted file, so depending on them as unique identifiers isn't infallible.

提交回复
热议问题