File actions: Copy To does not work for directories

Bug #622201 reported by William Friesen
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
kupfer
New
Wishlist
Unassigned

Bug Description

The File Actions plugin does not allow directories to be copied.
at kupfer/plugin/fileactions.py line 230

def valid_for_item(self, item):
 return (not item.is_dir()) and os.access(item.object, os.R_OK)

Is there a reason that directories are explicitly disallowed here?

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

yes, there is a reason. We simply use GIO for these file operations and when this was implemented, GIO did not do recursive directory copying. If it does now, we can add it in Kupfer. It's very beneficial to use GIO because of the complexities error handling, in my opinion.

Revision history for this message
William Friesen (william-friesen) wrote :

According to
http://www.pygtk.org/docs/pygobject/class-giofile.html#method-giofile--copy
GIO.File still can not handle recursive copies of directories.

Would it be ok to use shutil.copytree for this?
http://docs.python.org/library/shutil.html#shutil.copytree

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

I don't think it would be worth it to use shutil for this; it would be much less robust and we would need much more code for error handling; add to that the inconsistency with the other GIO-based file operations.

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

(On my wishlist is a program that we can delegate file operations to. It would be great if Copy To.. in Kupfer would simply start a normal nautilus file transfer; nautilus would have the implementation, show a progress dialog and allow cancelling etc as normal. This way of hooking into the normal programs of the desktop (compare file-roller) is superior.)

Revision history for this message
William Friesen (william-friesen) wrote :

https://bugzilla.gnome.org/show_bug.cgi?id=498506
shows that this functionality is being worked on, but nothing seems to have been committed yet.

Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

Wonderful to see this added to Nautilus, thanks for the bug pointer. Now we just need to get hold of a new version of nautilus and make a plugin for it

Changed in kupfer:
importance: Undecided → Wishlist
Revision history for this message
X (u78qir8a9-deactivatedaccount) wrote :

FYI, Thunar 1.2 has these actions available in it's D-bus API and I have implemented Move/Copy to using Thunar in the thunar plugin that is going to be merged after this week's release. (You can use Thunar as a service, you don't need to use it as file manager). It's a step on the way.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.