NSWorkspace needs a "Move To Trash" method allowing user interaction
| Originator: | tempelmann | ||
| Number: | rdar://17579747 | Date Originated: | 07-Jul-2014 |
| Status: | Open | Resolved: | |
| Product: | OS X SDK | Product Version: | 10.9 |
| Classification: | Reproducible: |
This is a request for a Cocoa API update. Reason: Plenty of apps have the need to delete files, and often it's smart to just move them to the Trash. Implementing this on our own is error-prone due to many special cases (authorization needed, locked items, volumes without a trash folder, renaming in case there are already same-named items in the trash, etc.). Effectively, what one needs is the very same one can get by sending an AppleEvent (AE) to the Finder for the "delete" command, with the SendMode values kAEAlwaysInteract+kAECanSwitchLayer. The problem is that AppleEvents have been deprecated (legacy!) and are probably not allowed in App Store submissions, either. The NSWorkspace performFileOperation method with the NSWorkspaceRecycleOperation parameter is not sufficient, for several reasons: - It's async. A synchronous operation is needed (works via AE). - One cannot pass a bunch of items from different folders (works via AE). - There is no user interaction when the operation need attention from the user. In summary, there is no suitable replacement for what the Finder AppleEvent gave us, and that sucks. So, please consider giving us something back in the way the good old AppleScripting feature gave us.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!