[launchd-dev] WatchPaths

Brian Hanson bwhanson at gmail.com
Thu Feb 18 07:43:42 PST 2010


On the same subject, and apologies if this has been addressed elsewhere (I searched the archives to no avail), but does WatchPaths have the ability to pass the name (or path) of the item that triggered the job? In other words, using AppleScript folder actions, one can get the name of the item received in the folder. Is there a similar way to get this with WatchPaths? The receiving folder could have hundreds of files in it, so iterating through the folder, looking at mod dates, etc, wouldn't be stable enough.



On Feb 18, 2010, at 6:11 AM, Quinn wrote:

> At 15:47 -0600 17/2/10, Errol Sayre wrote:
>> For a launch agent with multiple watch paths, how does one pass the path that fired the event to the program arguments?
> 
> Your agent should monitor all of the paths it's been configured for. Otherwise it would be subject to a race condition:
> 
> 1. user touches path A
> 
> 2. launchd launches the agent with path A, but it takes a while to start up
> 
> 3. user touches path B
> 
> 4. agent runs and processes path A
> 
> 5. path B is never processed
> 
> S+E
> -- 
> Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
> Apple Developer Relations, Developer Technical Support, Core OS/Hardware
> _______________________________________________
> launchd-dev mailing list
> launchd-dev at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/launchd-dev



More information about the launchd-dev mailing list