I'm actually using UKKQueue in the project (it's a great utility - thanks a 
lot!).

In some small tests I have seen that other apps break when moved while opened 
(testing with TextEdit), so perhaps I should just assume it won't move. I guess 
this is a moot issue then.
 
On Thursday, July 17, 2008, at 05:03PM, "Uli Kusterer" <[EMAIL PROTECTED]> 
wrote:
>On 17.07.2008, at 12:50, Mitchell Livingston wrote:
>> I need to pass the location to a c library and reset the location in  
>> this library when the application is moved, so I need a way to know  
>> when the app is moved.
>
>> How can I call it again if I don't know it moved? Waiting until it  
>> fails is a bit too late in the process. Sure, chances are the app  
>> won't move, but why should it ever fail? Storing it in the library  
>> folder is not a real good option.
>
>
>As someone else said, use a kqueue to detect the app move. I wrote a  
>nice little wrapper class around kqueues for uses like this, find it at
>
>       <http://www.zathras.de/angelweb/sourcecode.htm#UKKQueue>
>
>Watch your application bundle folder with that, and when it notifies  
>you that you've been moved, you can call into your library, passing  
>whatever NSBundle pathForResource: returns then.
>
>Just be aware that Cocoa itself is kinda stupid about coping with the  
>current app's bundle being moved (different from Carbon, funnily  
>enough). So, while your library might still access the correct  
>folders, the rest of your app may still go down in flames. Come to  
>think of it, I'm not even sure whether NSBundle doesn't cache its  
>location, so you might get the old path back. But I guess since the  
>kqueue tells you where it got moved, you could deduce the path anyway.
>
>Cheers,
>-- Uli Kusterer
>"The Witnesses of TeachText are everywhere..."
>http://www.zathras.de
>
>
>
>
>
>
>
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to