#2260 File.copyTo() overwrite func is passed the wrong file

SlimerDude Sun 13 Apr 2014

The docs for File.copyTo(...) say:

The overwrite option can also be a function of type |File f->Bool| which is passed 
every destination file to be overwritten.

which is good and what you want. But the overwrite func seems to be passed the source file instead:

class Example {
  Void main() {
    tempFile := File.createTemp.deleteOnExit
    podFile  := Env.cur.homeDir + `lib/fan/sys.pod`

    podFile.copyTo(tempFile, ["overwrite": |File file -> Bool| {
      echo(file.normalize.osPath)  // --> C:\Apps\fantom-1.0.66\lib\fan\sys.pod
      return false


brian Sun 13 Apr 2014

Promoted to ticket #2260 and assigned to brian

Good catch - I will fix next week

SlimerDude Sun 13 Apr 2014

Gee, I've just prompted 3 tickets in the past week... Cool, I feel like I'm back on form! : )

Login or Signup to reply.