fsevents

reloadData in NSTableView but keep current selection

核能气质少年 提交于 2019-12-03 10:11:36
I have an NSTableView showing the contents of a directory. I watch for FSEvents, and each time I get an event I reload my table view. Unfortunately, the current selection then disappears. Is there a way to avoid that? OzBandit It depends on how you populate your NSTableView. If you have the table view bound to an NSArrayController, which in turn contain the items that your table view is displaying, then the NSArrayController has an option to preserve the selection. You can select it (or not) from within Interface Builder as a property on the NSArrayController. Or you can use the

Cocoa, FSEvents, kFSEventStreamCreateFlagFileEvents flag and “renamed” events

左心房为你撑大大i 提交于 2019-12-03 07:49:59
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 little image viewer, and I want its content to update when the content of the HDD changes) I create my stream using the kFSEventStreamCreateFlagFileEvents flag, but I have a hard time figuring out how those events are generated by the OS (or the kernel, or whatever) And unfortunately, there is no documentation with the events generated with this flag ... It seems they are new to 10.7, and still not documented. So, my main problem is

File-level filesystem change notification in Mac OS X

青春壹個敷衍的年華 提交于 2019-12-03 04:48:14
问题 I want my code to be notified when any file under (either directly or indirectly) a given directory is modified. By "modified", I mean I want my code to be notified whenever a file's contents are altered, it's renamed, or it's deleted; or if a new file is added. For my application, there can be thousands of files. I looked as FSEvents, but its Technology Overview says, in part: The important point to take away is that the granularity of notifications is at a directory level. It tells you only

How to listen for file system changes MAC - kFSEventStreamCreateFlagWatchRoot

拈花ヽ惹草 提交于 2019-12-03 03:01:36
I am listening for Directory and disk changes in a Cocoa project using FSEvents . I need to get events when a root folder is renamed or deleted. So, I passed kFSEventStreamCreateFlagWatchRoot while creating the FSEventStream . But even if I delete or rename the root folder I am not getting corresponding FSEventStreamEventFlags . Any idea what could possibly be the issue. I am listening for changes in a USB mounted device. I used both FSEventStreamCreate and FSEventStreamCreateRelativeToDevice . One thing I notices is when I try with FSEventStreamCreate I get the following error message while

File-level filesystem change notification in Mac OS X

自闭症网瘾萝莉.ら 提交于 2019-12-02 19:08:44
I want my code to be notified when any file under (either directly or indirectly) a given directory is modified. By "modified", I mean I want my code to be notified whenever a file's contents are altered, it's renamed, or it's deleted; or if a new file is added. For my application, there can be thousands of files. I looked as FSEvents, but its Technology Overview says, in part: The important point to take away is that the granularity of notifications is at a directory level. It tells you only that something in the directory has changed, but does not tell you what changed. It also says: The

Not compatible with your operating system or architecture: fsevents@1.0.11

孤者浪人 提交于 2019-12-02 17:49:24
I'm using Ubuntu 15.04. While running the following command: npm install fsevents I'm getting following error: npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.11 npm WARN tutorial@1.0.0 No repository field. Has anybody solved this? I was facing the same issue with this dependecy when building other application. Just for the sake of knowledge and to people who are not well used to NPM, and thus uncertain about how their applications will behave: Since fsevents is an API in OS X

How to dectect new or modified files in Mac OSX

本秂侑毒 提交于 2019-11-30 14:47:36
In Windows OS, MS provides ReadDirectoryChangesW and FindFirstChangeNotification API to dectect new or modified file, does the Mac OSX provide equal function as well? In Mac OS X Leopard monitor file changes with the File System Events API See http://pypi.python.org/pypi/MacFSEvents/0.2.1 for a Python implementation. OS X provides a framework called FSEvents , I don't know much about the specifics of it though. 来源: https://stackoverflow.com/questions/645321/how-to-dectect-new-or-modified-files-in-mac-osx

FSEvents and copying large files

≯℡__Kan透↙ 提交于 2019-11-30 14:02:49
I'm using FSEvents to monitor a directory of files that will have some large files copied into it. Currently FSEvents seems to be sending out a notification when I've begun copying the file, and again when it's finished copying the file. When it's a smaller file though, I only get the one event. Is there any way to check if a file is in the middle of being copied? This is for Snow Leopard by the way. I ended up just using lsof to check if the file is open at a kernel level. I only begin processing the file once lsof has determined that the file is no longer in use. 来源: https://stackoverflow

tracking file renaming/deleting with FSEvents on Lion

做~自己de王妃 提交于 2019-11-30 08:37:40
I'm trying to use FSEvents to detect when files were added/removed from a specific folder. For the moment, I implemented a simple wrapper around FSEvents, and it works fine : I get all the events. BUT the problem I have now is that when I rename a file in the Finder, I catch 2 distinct events : the first one of type "renamed" with the old file name, and another one with "renamed" and the new filename. The event ids are different between both calls. So, how am I supposed to know which "renamed" event contains the old name, and which event contains the old one ?? I tried looking in the

How to dectect new or modified files in Mac OSX

ぐ巨炮叔叔 提交于 2019-11-29 22:21:26
问题 In Windows OS, MS provides ReadDirectoryChangesW and FindFirstChangeNotification API to dectect new or modified file, does the Mac OSX provide equal function as well? 回答1: In Mac OS X Leopard monitor file changes with the File System Events API 回答2: See http://pypi.python.org/pypi/MacFSEvents/0.2.1 for a Python implementation. 回答3: OS X provides a framework called FSEvents, I don't know much about the specifics of it though. 来源: https://stackoverflow.com/questions/645321/how-to-dectect-new-or