FS#3033 - Cut/Copy/Paste in the Dir Browser

Attached to Project: Rockbox
Opened by Dan Everton (safetydan) - Thursday, 16 February 2006, 22:17 GMT
Last edited by Dan Everton (safetydan) - Wednesday, 08 March 2006, 20:27 GMT
Task Type Patches
Category Applications
Status Closed
Assigned To Dan Everton (safetydan)
Operating System All players
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


Patch adds context menu items to the onplay menu. Users
can cut/copy a file to a new directory by pasting them
in the new directory. Works the same as in Windows for
This task depends upon

View Dependency Graph

This task blocks these from closing
 FS#2992 - Copy, Paste and Cut 
Closed by  Dan Everton (safetydan)
Monday, 20 March 2006, 12:00 GMT
Reason for closing:  Accepted
Additional comments about closing:  Now in CVS.
Comment by Anonymous Submitter - Friday, 17 February 2006, 16:40 GMT

Comment by Christi Scarborough (christi-s) - Friday, 17 February 2006, 17:03 GMT

You will probably get better performance if you modify the
code to edit the FAT directly for cut/paste operations.
(This won't work for copy, of course.)
Comment by Alexander Spyridakis (xaviergr) - Saturday, 25 February 2006, 00:02 GMT
You could use the plugin buffer for "read". If I am not mistaken thid buffer is empty all the time, except if a 'tsr' plugin is loaded, like battery_bench or alpine_cdc
Comment by Jens Arnold (amiconn) - Saturday, 25 February 2006, 22:36 GMT
The plugin buffer could definitely be used as data buffer for copying. plugin_get_buffer() will give you whatever is left, either the complete buffer, or when a TSR plugin is loaded, whatever is left. TSR plugins are not allowed to use plugin_get_buffer() themselves, so this is safe. If the available plugin buffer size is too small, you can resort to the stack. The copy buffer should at least be 512 byte (one sector), more is better but in multiples of 512. 1KB or 2KB on the stack should be okay.

Editing the FAT should work for moving, but only if the file stays on the same volume. It's important to check this, as we do have one platfrom in CVS that has multivolume support enabled, the Ondio. The H300 will probably follow if we get USBOTG going.

Also keep an eye on code size. Directory move/copy would be nice as well, and when the destination file exists *and* time stamp and size are the same, there's no need to ask for overwrite.
Comment by Dan Everton (safetydan) - Monday, 27 February 2006, 21:16 GMT
Newer version of the patch with not much different. The code is cleaner, and it attempts to use the plugin buffer to speed up file copies. Results in a 60% (1.12 MByte/s vs 1.84 MByte/s) speed increase in file copies.
Comment by Dan Everton (safetydan) - Tuesday, 28 February 2006, 22:13 GMT
And yet another version. Now supports directory cut/copy and paste. Also fixes file copying. I've no idea how that was working before.

It'd be great if someone else could review this because it's a big chunk of code and has many possible failure cases.
Comment by Marko Pahlke (perfectdrug) - Wednesday, 01 March 2006, 06:15 GMT
when copying a playlist
can you maybe put in a dialogue box which is asking to copy the playlist or the files within a playlist...
would be a really nice addition
Comment by needleboy (needleboy) - Wednesday, 01 March 2006, 08:12 GMT
crashes on latest CVS with this:

CC onplay.c
onplay.c: In function `clipboard_pastefile':
onplay.c:568: error: called object is not a function
make[1]: *** [/home/guest/rockbox-devel/build/apps/onplay.o] Error 1
make: *** [all] Error 2
Comment by Dan Everton (safetydan) - Wednesday, 01 March 2006, 09:01 GMT
Sorry about that. Should actually try compiling for target before assuming it works. This version of the patch at least compiles.
Comment by Joerg Bierstedt (JoergBierstedt) - Thursday, 02 March 2006, 09:02 GMT
Wow! also works for Ondio to copy a directory from the internal memory to MMC and vice a versa!. It seems to hung after a while (no progress bar), but all files in the directory were copied fine.
Comment by Dan Everton (safetydan) - Thursday, 02 March 2006, 20:18 GMT
New version that should support cut and paste of files across volumes (i.e. from internal memory to MMC on Ondio). Previously on copy would work. Also fixed a bug in the file copying routines.
Comment by Dan Everton (safetydan) - Wednesday, 08 March 2006, 20:26 GMT
Another version with no new features. Slightly smaller compiled size. Also the copy buffer size is kept to a multiple of the disk sector size for a possible speed boost in file copy.