[TxMt] Auto-Refresh the project drawer

Chris Thomas chris at m-audio.com
Sat Jan 29 21:29:01 UTC 2005


On Jan 29, 2005, at 8:42 AM, Sune Foldager wrote:

> On 29. jan 2005, at 15:09, Michael Gregoire wrote:
>
>> Well, when adding files, a person should have the ability to refresh 
>> manually, or an auto refresh should occur after a new files is added, 
>> rather than have to bring to focus another application and come back 
>> to TM, which I may add doesn't always guarantee a refresh. I have a 
>> couple times where the refresh simply didn't happen and I had to 
>> quite and open TM again, in order for the new files to be added to my 
>> list.
>>
>
> The best would maybe be to have the OS tell when files were updated, 
> but I don't know how well that system is actually implemented.

man kqueue. It works well enough, but the API -- copied from FreeBSD -- 
is the usual inscrutable Unix cruft[*]. However:

http://www.zathras.de/angelweb/sourcecode.htm
http://www.zathras.de/programming/cocoa/UKKQueue.zip

> A wrapper class around the kqueue file change notification mechanism.
>
> Simply create a UKKQueue, add a few paths to it and listen to the 
> change notifications via NSWorkspace's notification center.

You may or may not want to use the UKKQueue code, but it demonstrates 
how to do it.

Chris

[*] but at least it doesn't require you to hardcode a fixed number of 
file descriptors, unlike some...




More information about the textmate mailing list