Re: Application upgrades itself?
Re: Application upgrades itself?
- Subject: Re: Application upgrades itself?
- From: Uli Kusterer <email@hidden>
- Date: Mon, 24 Jul 2006 14:30:49 +0200
Am 24.07.2006 um 03:45 schrieb Bobby B:
I've encountered a bit of a logic problem. I want to put an option in
my .app to make it upgradeable (ie, they have a new copy of my app
downloaded, and the app will make it easy for them to copy it over and
restart itself -- this sounds stupid, but in the context of this app
its almost a necessity)
Not stupid at all. Many applications do this. Sparkle is even a
framework that does this automatically and correctly. Also, it's not
that hard on a Unix system like Mac OS X. You can actually delete a
file that is still open and running, and the copy in RAM will stay
available (I'm simplifying here).
The trouble starts when you have an application bundle, because a
NIB or other support file your app may still need may have been
deleted and may not be open, so will be gone completely and cause
your app to fail. But if you can guarantee that no code path that
needs any of your support files will run after you've deleted
yourself, this should Just Work(tm). However, it's very easy to break
this constraint, especially considering that most of the code in your
app is in AppKit, and there's no telling what AppKit may decide to
load lazily.
All the file handling is simple, but I don't understand *how* this can
work. I would have to copy over the .app that is currently loaded.
May anyone offer a suggestion? This should be pretty simple, but I
can't seem to figure out this bit of it.
A common approach that e.g. SuperCard used on System 7 was to have
a "bridger" application. For your case, Bridger could be a very
simple, standalone command line tool in your app's bundle that can
delete itself without problems, and will delete the old version and
copy in the new one instead, then launch that. The new version would
of course include a new version of Bridger. Or you could play it even
safer and copy your Bridger into Application Support, so it won't
have to delete itself at all.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden