1

When we try to delete/uninstall Cocoa .app file ,we directly move the .app file to trash. This does not ensure the deletion of app user data folder in application support. The user data lies there hanging. So i wanted to save the user data/ files inside application itself (app->showPacakge contents->somewhere).

If it is not possible! Any ways of clearing app user data folder in application support when user moves app to trash ?

Satyam Raikar
  • 465
  • 6
  • 20
  • Include an "Uninstall" function within your app, and prominently tell users to use it instead of dragging the app to Trash. The function should erase the data, and then move the app to Trash. Unfortunately this nutty idea to "drag an app to Trash" means you can never properly uninstall an app unless you go through that extra step. I've resolved myself to always use AppCleaner and never "drag an app to Trash". I've no idea why Apple engineers didn't see the need to run a "dragged to Trash" uninstall script or even just do what AppCleaner does and move related files to Trash as well. – ADTC Jan 31 '23 at 18:31

2 Answers2

2

Not a great idea.

The package content is signed. Any modification will be detected by the OS and will prevent launching of the app.

Not to mention the fact that you might not have access to the Applications folder, where most users will keep their app.

cacau
  • 3,606
  • 3
  • 21
  • 42
  • This. The Application Support folder is the platform-standard place to put non-document application data. Don't reinvent the wheel. – ipmcc May 22 '14 at 11:19
  • If it is not possible! Any ways of clearing app user data folder in application support when user moves app to trash ? – Satyam Raikar May 22 '14 at 11:53
  • @SatyamRaikar The intended design behind the `Application Support` folder is to preserve small app preferences files so that settings will be preserved if the user reinstalls the program. If you're worried that something in the `Application Support` folder will take up too much space after your app is deleted, you should place your app's "Library" in a user accessible folder like `Documents`. – spudwaffle May 23 '14 at 04:53
  • Any ways of clearing app user data folder in application support when user moves app to trash ? – Satyam Raikar May 26 '14 at 04:08
  • As you're not running at that time there's nothing you can do - users can use tools like App Cleaner and the like that would perform exactly this task – cacau May 28 '14 at 13:53
1

if you are using packages for installing your application, then you can have pre-install script, which deletes user data in the application support folder.

Priya Raj
  • 71
  • 1
  • 5