O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Example

Example 16.5 shows a program that displays all of the historical events for the boot drive that have happened since it was last run. After that, it displays new events as they occur. To keep things simple, it exits after seeing 20 new events. It saves the device UUID and last event ID to the user defaults when it quits.

Example 16.5. fsevents.m

/​/​ ​f​s​e​v​e​n​t​s​.​m​ ​-​-​ ​W​a​t​c​h​ ​f​i​l​e​ ​s​y​s​t​e​m​ ​e​v​e​n​t​s​.​ /​/​ ​g​c​c​ ​-​s​t​d​=​c​9​9​ ​-​g​ ​-​W​a​l​l​ ​-​f​r​a​m​e​w​o​r​k​ ​F​o​u​n​d​a​t​i​o​n​ ​-​f​r​a​m​e​w​o​r​k​ ​C​o​r​e​S​e​r​v​i​c​e​s​ /​/​ ​ ​ ​ ​ ​-​o​ ​f​s​e​v​e​n​t​s​ ​f​s​e​v​e​n​t​s​.​m​ #​i​m​p​o​r​t​ ​<​F​o​u​n​d​a​t​i​o​n​/​F​o​u​n​d​a​t​i​o​n​.​h​>​ #​i​m​p​o​r​t​ ​<​C​o​r​e​S​e​r​v​i​c​e​s​/​C​o​r​e​S​e​r​v​i​c​e​s​.​h​>​ ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required