Re: My app breaks when moved while running
Re: My app breaks when moved while running
- Subject: Re: My app breaks when moved while running
- From: Gregory Weston <email@hidden>
- Date: Fri, 8 Feb 2008 07:42:37 -0500
Phil wrote:
I could be mistaken but I don't think there's a good mechanism to do
this. You should probably file a bug against the Finder for allowing
the user to do this without at least warning them that they should
quit the application before moving/renaming it (but even this would
still only be a partial solution: what if the user renamed a directory
in the path to the executable or moved their apps directory somewhere
else while running?) It seems like it would be a significant amount
of effort, both in the Apple frameworks and for app developers, to
keep a non-trivial application functioning properly to being moved/
renamed while running vs. what percentage of users would ever attempt
to do this even once.
While the raw effort *is* probably significant, the solution seems
fairly straightforward. Instead of relying on cached paths (or
whatever static structure is underlying these problems), the bundle
mechanisms could be caching aliases. Obviously there's not a
widespread habit among users of moving a running app, but it's
something that historically didn't inherently break anything. From a
little experimentation, it seems like there's no way to *not* break a
package-style app by moving it; among the "important doodads" that
can't be reliably retrieved are the nib files that would define other
windows, views, etc.
What I'd be worried about are UIElement-type apps. The things that
users tend to leave running over their entire session, some of which
do have discrete Finder icons (rather than being resources of a
prefPane or the like).
Actually, there *is* a workaround. Cache an alias to the main bundle
at launch time, and then go out of your way to never rely (explicitly
or implicitly) on the main bundle again. Instead, create a bundle for
the resolved alias any time you need to do anything.
G
_______________________________________________
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