As a side note I would test for existence only using .e because a directory could exist by that same name. Method .f would return False following an attempt to create a file which will fail.

Marcel


On March 21, 2017 12:28:13 Philip Hazelden <philip.hazel...@gmail.com> wrote:

$PathAndName.IO.f or $PathAndName.IO.open(:w).close;

Note, the following sequence is possible:
1. .IO.f returns false
2. Someone creates the file and writes some data to it
3. .IO.open truncates the file

Thus, this has a chance of editing the file.

I suggest instead (untested):
    $PathAndName.IO.open(:a).close
:a (append) will create the file if it doesn't exist, but will not truncate
it if it does. There's no need to check first whether the file exists.

On Tue, Mar 21, 2017 at 11:08 AM ToddAndMargo <toddandma...@zoho.com> wrote:

On 03/21/2017 04:02 AM, Simon Proctor wrote:
> It's a logical test but I'd probably use || instead.

Thank you!

Reply via email to