Skip to content
Prev 59690 / 63433 Next

NEWS item for bugfix in normalizePath and file.exists?

On 4/28/21 5:22 PM, Martin Maechler wrote:
Yes, I agree with Toby and you that there is benefit in allowing 
per-element, vectorized use of file.exists(), and well it is the case 
now, we just fall back to FALSE. NA might be be better in case of error 
that prevents the function from deciding whether the file exists or not 
(e.g. an invalid name in form that make is clear such file cannot exist 
might be a different case...).

But, the only way to get a translation error is by passing a string to 
file.exists() which is invalid in its declared encoding (or which is in 
"C" encoding). I would hope that we could get to the point where such 
situation is prevented (we only allow creation of strings that can be 
translated to Unicode). If we get there, the example would fail with 
error (yet, right, before getting to file.exists()).

My point that I would not write tests of this behavior stands. One 
should not use such file names, and after the change Toby reported from 
ERROR to FALSE, Martin's proposal would change to NA, mine eventually to 
ERROR, etc. So it is best for now to leave it unspecified and not 
trigger it, I think.

Tomas