[m-users.] io.error type
Julien Fischer
jfischer at opturion.com
Fri Feb 4 21:36:28 AEDT 2022
On Fri, 4 Feb 2022, Sean Charles (emacstheviking) wrote:
> What backend are you using...C ? You could wrap 'fstat' or something
> to do the job... I must confess to a little surprise that we seem to
> have no library function to test for 'file exists' but in a way,
> that's the end developers issue, Mercury is not about covering all
> things to all men on all platforms as I understand it.
The io module has both io.check_file_accessibility and io.file_type.
They won't defintively tell you if a file doesn't exit as opposed to
be not being accessible for some other reason (e.g. hard disk no longer
working). FWIW, we use io.file_type in the compiler to check whether file
exist.
As a general point, the standard library is designed so that, as much as
possible, operations in it will behave the same across all the target
languages and platforms. When things like file systems are involved
this can restrict what functionality we provide.
Julien.
More information about the users
mailing list