Re: notification when app is moved
Re: notification when app is moved
- Subject: Re: notification when app is moved
- From: "Michael Ash" <email@hidden>
- Date: Thu, 17 Jul 2008 00:57:15 -0400
On Wed, Jul 16, 2008 at 9:08 PM, Mitchell Livingston <email@hidden> wrote:
> Hello,
>
> I have code that must know where a folder inside the Resources folder of the
> application is. This location must be updated whenever the app is moved to
> another location. Is there some sort of callback I can register to receive
> for this?
You can really break this into two pieces:
1) Getting notified when your application moves
2) Finding the new location
1 can be accomplished by using kqueue to watch the containing
directory. 2 can be accomplished by keeping an FSRef to your app in
memory, and resolving it to a path on demand. Note that there is going
to be a certain potential for a race condition between getting 1 and
performing 2, so code with caution.
However, this all seems somewhat academic to me. Cocoa quite simply
does not support moving application packages. It doesn't do this kind
of tracking internally, so when you move, suddenly anything that uses
Cocoa calls directly to find paths to internal application resources
will break. To see what I mean, run TextEdit, move it onto the
desktop, and try to open the preferences or about panel. It falls down
rather hard. So, while you may be able to make this piece of code
behave, you won't be able to make the rest of your app behave, which
probably makes the whole exercise pointless.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden