[swift-users] FileManager.copyItem not throwing?

Marco S Hyman marc at snafu.org
Sat Nov 11 18:28:00 CST 2017



> On Nov 11, 2017, at 2:07 PM, John Brownie <john_brownie at sil.org> wrote:
> 
> And that's the point. The throw does not happen. An error is logged, but execution continues as though there was no error.

Also...

My workaround for this bug assumes you tested for the destination file presence BEFORE doing the copy and removing/moving one away if found.  Otherwise you won’t know if you are looking at an older version of the file when testing after the copy.

In my code I’m making a versioned backup and loop over file names (file-1, file-2, ... file-n) until I find a name that is not in use and then attempt the copy.

Marc


More information about the swift-users mailing list