PDA

View Full Version : App to detect drag to trash uninstallation




mycompuser
Jul 10, 2012, 03:44 AM
Hi All,

My development environment is XCode 4.3.2 on Lion.

My cocoa XCode .app gets installed in the Applications folder.

The app generates debug log files under
/Users/Logged-inUser/Library/Application Support/MyApp/

(logs needed for debugging issues reported by customers)

If I were to drag the application and trash out the same, though the application is uninstalled from the machine, these log files continue to be there.

Is there a mechanism by which I can get notified when the user drags the app to trash for uninstallation so that I can handle the notification to perform necessary cleanup?

Thanks & Regards.



charlieegan3
Jul 10, 2012, 03:49 AM
Not sure if this is possible. Could create an uninstall menu item for them, but they most likely wouldn't use it.

lots of peoples apps leave stuff behind, not that its good, but it is kind of accepted.

mycompuser
Jul 10, 2012, 04:10 AM
Could create an uninstall menu item for them, but they most likely wouldn't use it.


My app does have this option and when uninstalled via this means the uninstallation is clean.

Wanted to make my app better by doing the necessary cleanup even for drag to trash uninstallation scenario also hence this thread.

charlieegan3
Jul 10, 2012, 04:31 AM
Yeah i'm not sure if its possible.

whooleytoo
Jul 10, 2012, 05:27 AM
I guess you could have a small helper app running in the background; which watches the Applications (or your app's folder within it, if applicable) for changes. When the main app has been deleted, it deletes the logs etc. It would, of course, leave a helper app lying around.

You could look at FSEvents (https://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/FSEvents_ProgGuide/Introduction/Introduction.html) (a C API) to do this.

mycompuser
Jul 10, 2012, 05:34 AM
I guess you could have a small helper app running in the background; which watches the Applications (or your app's folder within it, if applicable) for changes. When the main app has been deleted, it deletes the logs etc. It would, of course, leave a helper app lying around.

You could look at FSEvents (https://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/FSEvents_ProgGuide/Introduction/Introduction.html) (a C API) to do this.

Yes, I did think of this solution but then the solution is unacceptable as the helper app will still be there and it defeats the the whole purpose of a clean uninstallation.