Module safeio

Data Types

filetype()

filetype() = regular_file | directory | other_filetype

ioerror()

ioerror() = permission_denied | io_error | not_found | bad_path | other_error

Function Index

can_stat/1 Return true if calling stat on Path was successful.
can_stat/2 Return true if calling stat on Path was successful.
is_regular/2 Check that RootDirectory++"/"++RelativePath is a regular file.
is_regular/3 Check that RootDirectory++"/"++RelPath is a regular file.

Function Details

can_stat/1

can_stat(Path::file:filename()) -> boolean()

Return true if calling stat on Path was successful.

See also: can_stat/2.

can_stat/2

can_stat(Path::file:filename(), TimeOutMillis::timeout()) -> boolean()

Return true if calling stat on Path was successful.

This function will not cause file or filelib operations to block, in case the underlying stat operation blocks. This is in contrast to file and filelib behaviour, where filelib:is_regular/1 on a path that is in a stale NFS mount will cause other filelib:... operations on totally unrelated paths to block, too.

Also, subsequent invocations will immediately return false if a check for Path, that was initiated by previous invocation, has not returned yet.

This mechanism works by starting an internal server for each distinct Path, see info/1.

is_regular/2

is_regular(RootDirectory::file:filename(), RelativePath::file:filename()) -> boolean()

Check that RootDirectory++"/"++RelativePath is a regular file. Return false if filesystem errors or timeouts were encountered.

See also: is_regular/3.

is_regular/3

is_regular(RootDir::file:filename(), RelPath::file:filename(), TimeOut::timeout()) -> boolean()

Check that RootDirectory++"/"++RelPath is a regular file. Return false if filesystem errors or timeouts were encountered.

The non-functional behaviour regarding safe access to directories is the same as in can_stat/2.


Generated by EDoc