overriding FileReference>>copyTo: behavior

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

overriding FileReference>>copyTo: behavior

Peter Uhnak
Hi,

is there an API to copy a file that will override the target destination if it already exists? I was quite surprised that #copyTo: (and #copyAllTo:) will throw up when the target file already exists.

Do I need to explicitly remove the file before copying / copy the contents instead?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: overriding FileReference>>copyTo: behavior

Peter Uhnak
Ideally something that works as updater only (doesn't touch nor change modification time if the contents is the same)

On Mon, Sep 17, 2018 at 1:16 PM Peter Uhnak <[hidden email]> wrote:
Hi,

is there an API to copy a file that will override the target destination if it already exists? I was quite surprised that #copyTo: (and #copyAllTo:) will throw up when the target file already exists.

Do I need to explicitly remove the file before copying / copy the contents instead?

Thanks,
Peter
Reply | Threaded
Open this post in threaded view
|

Re: overriding FileReference>>copyTo: behavior

Sven Van Caekenberghe-2
target exists ifFalse: [ source copyTo: target ]

?

> On 17 Sep 2018, at 13:27, Peter Uhnak <[hidden email]> wrote:
>
> Ideally something that works as updater only (doesn't touch nor change modification time if the contents is the same)
>
> On Mon, Sep 17, 2018 at 1:16 PM Peter Uhnak <[hidden email]> wrote:
> Hi,
>
> is there an API to copy a file that will override the target destination if it already exists? I was quite surprised that #copyTo: (and #copyAllTo:) will throw up when the target file already exists.
>
> Do I need to explicitly remove the file before copying / copy the contents instead?
>
> Thanks,
> Peter