#2588 File.copyTo Options

go4 Thu 29 Dec 2016

I just want to copy the changed files when copy from directory. But the overwrite option is a function of |File f->Bool|, the source file param is missed.

I expected the API like this;

scrDir.copyTo(dstDir, ["overwrite" : |from, to->Bool| {
  from.modifyTime > to.modifyTime
}])

SlimerDude Fri 30 Dec 2016

Hi go4, I believe you're right - a from source file is missing and would be useful.

Especially in your case when you're copying a directory, and the function is invoked for every file under it. Because then you have no idea what the source file is!

brian Mon 2 Jan 2017

I pushed a fix. But to keep backward compatibility the order for the closure functions is going to be |File to, File from->Bool|

Login or Signup to reply.