Hi,
Now I got "cp: ommitting directory '/tmp/.font-unix' " when copying directories. Googled a bit and found that directory copy should have -R option.
cmd = ["cp -R \""+filename+"\" \""+targetDir+"\""]
Then I found that def goYellow def still misses the stuff that you did with the goGreen def (titletext). And the string compilated for copy should be identical to the string for move def.
self.session.openWithCallback(self.doCopy,ChoiceBox, title = titletxt+"?\n%s\nfrom %s to %s"%(filename,sourceDir,targetDir),list=[(_("yes"), True ),(_("no"), False )])
Here is the code I made that makes everything working. I love the simplicity of this plugin and no it work for both directories and files! Thank you very much @dre!
Python
def goYellow(self):
if not(self.SOURCELIST.canDescent()) or (self.SOURCELIST.canDescent() and self.SOURCELIST.getSelectionIndex()!=0):
filename = self.SOURCELIST.getFilename()
sourceDir = self.SOURCELIST.getCurrentDirectory()
targetDir = self.TARGETLIST.getCurrentDirectory()
if self.SOURCELIST.canDescent():
titletxt = _("copy directory")
else:
titletxt = _("copy file")
self.session.openWithCallback(self.doCopy,ChoiceBox, title = titletxt+"?\n%s\nfrom %s to %s"%(filename,sourceDir,targetDir),list=[(_("yes"), True ),(_("no"), False )])
else:
return
def doCopy(self,result):
if result is not None:
if result[1]:
filename = self.SOURCELIST.getFilename()
sourceDir = self.SOURCELIST.getCurrentDirectory()
targetDir = self.TARGETLIST.getCurrentDirectory()
if self.SOURCELIST.canDescent():
cmd = ["cp -R \""+filename+"\" \""+targetDir+"\""]
titletxt = _("copying directory ...")
else:
cmd = ["cp \""+sourceDir+filename+"\" \""+targetDir+"\""]
titletxt = _("copying file ...")
self.session.openWithCallback(self.doCopyCB,Console, title = titletxt, cmdlist = cmd)
Alles anzeigen