Opened 8 years ago

Last modified 8 years ago

#289 new Enhancement

Recoverable file delete

Reported by: wazza Owned by:
Priority: normal Milestone: Beta 7
Component: Browser Version: 1.0b7
Keywords: Cc:


It would be nice if file deletion used the Trash instead of removing files permanently. The attached patch modifies the existing implementation to do this.

I'm not sure if Trash exists on the Apple TV, but I assume it does.

Attachments (1)

delete_to_trash.diff (1.0 KB) - added by wazza 8 years ago.

Download all attachments as: .zip

Change History (6)

Changed 8 years ago by wazza

comment:1 Changed 8 years ago by wazza

Sorry, should be 1.0b7

comment:2 Changed 8 years ago by gbooker

  • Milestone set to Beta 7
  • Version changed from 1.0b6.5 to 1.0b7

There are some issues with this. On systems without a Trash, such as an SMB share, it will fail, and do nothing. Also, using cStringUsingEncoding should not be used for file system operations, but instead fileSystemRepresentation. Lastly, move to trash is likely better with NSWorkspace's performFileOperation:source:destination:files:tag: with the NSWorkspaceRecycleOperation operation.

What's the rationale for this patch? It is too easy to accidentally delete a file? Perhaps a better change would be to change the confirm delete to have a cancel as well as the OK, with cancel being the default?

comment:3 Changed 8 years ago by gbooker

Oh, one other thing: While the ATV likely has a trash (I haven't tested it, but it should have one), it is not accessible to the user. So files moved to the trash there will continue to consume disk space but the user will be unable to find them.

comment:4 Changed 8 years ago by wazza

I didn't think of SMB shares, that's a very good point. And thanks for the fileSystemRepesentation and NSWorkspace tips, I'm still learning Obj-C slowly and didn't know of their existence.

The rationale for the patch was two-fold. One was I thought the concept of file deletion could benefit from being a bit more "Mac"-y, I find the Unix deletion concept very unforgiving, and I suspect deleting the file outright would be contrary to the average Mac users expectations.

My second rationale was discovering my non-English speaking girlfriend had accidentally deleted a file, again the idea of a default Cancel is a good one. I guess non-English speakers are a use case Sapphire doesn't have much experience with. I put up the patch cos it's harder to reprogramme girlfriends compared to Sapphire :-)

Perhaps an nice middle ground could be first to attempt a move to Trash, and then a full delete if Trash is not available. That could be Leopard only, and the ATV version should just do a straight delete? Just a thought.

comment:5 Changed 8 years ago by gbooker

(In [865]) Made the confirm prompt include a cancel which is the default.
Refs #289

Note: See TracTickets for help on using tickets.