App to detect drag to trash uninstallation

Discussion in 'Mac Programming' started by mycompuser, Jul 10, 2012.

  1. macrumors member

    Joined:
    May 8, 2012
    #1
    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.
     
  2. macrumors 68020

    charlieegan3

    Joined:
    Feb 16, 2012
    Location:
    U.K
    #2
    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.
     
  3. thread starter macrumors member

    Joined:
    May 8, 2012
    #3
    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.
     
  4. macrumors 68020

    charlieegan3

    Joined:
    Feb 16, 2012
    Location:
    U.K
  5. macrumors 603

    whooleytoo

    Joined:
    Aug 2, 2002
    Location:
    Cork, Ireland.
    #5
    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 (a C API) to do this.
     
  6. thread starter macrumors member

    Joined:
    May 8, 2012
    #6
    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.
     

Share This Page