On Nov 28, 2005, at 11:38 AM, Mike Blaguszewski wrote:
A widget I'm working on creates some temporary image files that
need to get cleaned up when it exits. However, I haven't been able
to find the proper hook to hang my cleanup code on. Using
widget.onremove works when the widget is closed by the user, but
not on logout. I've tried a number of other possibilities
(window.onunload, dealloc method of my plugin, etc.) but nothing
seems to get triggered.
My current workaround is to put things in /tmp instead of
NSTemporaryDirectory(), so that the images don't show up as
"Recovered Items" in the Trash after logout. Does anyone know of a
proper solution, though?
Thanks,
--
Mike Blaguszewski / Cocoa Hacker / Ambrosia Software, Inc.
From a plugin, I use the (Carbon) Folder Manager to get the
"Chewable items folder" and put them there and keep a list of said
items in a global variable. I then install a
NSApplicationWillTerminateNotification notification (sent to the
class object, which will always exist) to make sure that I remove all
those things (and if the Widget crashes or otherwise terminates in a
manner inconsistent with cleanup, they'll eventually go away
eventually anyway).
Glenn Andreas email@hidden
<http://www.gandreas.com/> wicked fun!
Widgetarium | the quickest path to widgets
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Dashboard-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/dashboard-dev/email@hidden