Trash - General Discussion and Assistance - CHDK Forum

Trash

  • 2 Replies
  • 1488 Views
Trash
« on: 27 / July / 2012, 14:21:45 »
Advertisements
Hi,

I've created a trash for CHKD. If you apply the attached patch, you can activate the trash in the Misc. menu and then delete any file in the filebrowser. The file will then be moved to trash and you can delete or restore it, when you click on "Show Trash" in the Misc. menu. To clear the trash you can use "Clear Trash" (also in Misc. menu).

How it works:
If you click on remove in the filebrowser and the trash is activated the file will be moved to "A/CHDK/TRASH" and renamed to a number. Then the file will be "registered" in "A/CHDK/TRASH/_TRASH_.DAT" and can restored or deleted with the "trash viewer" (menu: Miscellaneous Stuff->Show Trash)

WARNING: This is a test version and can have bugs, so don't test it with important files.
It doesn't protect you from accidentally removed pictures, because it works only in CHDK(-Filebrowser)
Also the trash is (until now) not used if you use "Purge RAW"


Known Bugs:
  • You can't restore files if the folder where they come from is deleted!
  • You can only move files to trash (if you delete folders the files where moved to trash)
  • The "trash viewer" is not yet translated/translatable

If you want I can replace/modify the "remove" function so that all files which are deleted from CHDK come into trash.

If anyone wants to test it, but couldn't compile CHDK I can create testbuilds.

EDIT: Fixed the patch

TobiMarg
« Last Edit: 27 / July / 2012, 14:33:30 by TobiMarg »

*

Offline reyalp

  • ******
  • 14080
Re: Trash
« Reply #1 on: 27 / July / 2012, 16:10:19 »
Interesting work, but my initial reaction is this should not be added to CHDK.

In most cases, I expect if someone goes to the UI to delete, it means they really want to delete it. If they don't, then they should just rename it. So they should think before deleting, not depend on a trash function. I have never seen complaints from a user who accidentally deleted stuff with the file browsers, nor can I remember doing it myself. In that scenario, there are still FAT undelete utilities which should work pretty well if you act quickly.

A trash function which isn't entirely reliable would also be worse than none at all IMO.

The Canon UI doesn't include any undelete functionality, I don't think we need to be more idiot proof than the official UI.

Quote
If you want I can replace/modify the "remove" function so that all files which are deleted from CHDK come into trash.
This would be very bad, think scripts or raw ops that use temporary files.
Don't forget what the H stands for.

Re: Trash
« Reply #2 on: 28 / July / 2012, 04:10:45 »
Maybe better idea would be to add FAT undelete staff to the CHDK. However, I'm not sure if CHDK can operate on so low level and if it's worth of the work...

BTW, what comes to my mind is to add CHDK/TMP folder, which could be used for temporary files.
if (2*b || !2*b) {
    cout<<question
}

Compile error: poor Yorick