Directory¶
Operations on a directory.
The directory-relative functions (open, etc) use the *at interface on FreeBSD and Linux. This isn't available on OS X prior to 10.10, so it is not used. On FreeBSD, this allows the directory-relative functions to take advantage of Capsicum.
Constructors¶
create¶
This will raise an error if the path doesn't exist or it is not a directory, or if FileRead or FileStat permission isn't available.
Parameters¶
- from: FilePath val
Returns¶
- Directory ref^ ?
Public fields¶
let path: FilePath val¶
This is the filesystem path locating this directory on the file system and an object capability granting access to operate on this directory.
Public Functions¶
entries¶
The entries will include everything in the directory, but it is not recursive. The path for the entry will be relative to the directory, so it will contain no directory separators. The entries will not include "." or "..".
Returns¶
open¶
Open a directory relative to this one. Raises an error if the path is not within this directory hierarchy.
Parameters¶
- target: String val
Returns¶
- Directory iso^ ?
mkdir¶
Creates a directory relative to this one. Returns false if the path is not within this directory hierarchy or if FileMkdir permission is missing.
Parameters¶
- target: String val
Returns¶
- Bool val
create_file¶
Open for read/write, creating if it doesn't exist, preserving the contents if it does exist.
Parameters¶
- target: String val
Returns¶
- File iso^ ?
open_file¶
Open for read only, failing if it doesn't exist.
Parameters¶
- target: String val
Returns¶
- File iso^ ?
info¶
Return a FileInfo for this directory. Raise an error if the fd is invalid or if we don't have FileStat permission.
Returns¶
- FileInfo val ?
chmod¶
Set the FileMode for this directory.
Parameters¶
- mode: FileMode box
Returns¶
- Bool val
chown¶
Set the owner and group for this directory. Does nothing on Windows.
Parameters¶
Returns¶
- Bool val
touch¶
Set the last access and modification times of the directory to now.
Returns¶
- Bool val
set_time¶
Set the last access and modification times of the directory to the given values.
Parameters¶
Returns¶
- Bool val
infoat¶
Return a FileInfo for some path relative to this directory.
Parameters¶
- target: String val
Returns¶
- FileInfo val ?
chmodat¶
Set the FileMode for some path relative to this directory.
Parameters¶
Returns¶
- Bool val
chownat¶
Set the FileMode for some path relative to this directory.
Parameters¶
Returns¶
- Bool val
touchat¶
Set the last access and modification times of the directory to now.
Parameters¶
- target: String val
Returns¶
- Bool val
set_time_at¶
Set the last access and modification times of the directory to the given values.
fun box set_time_at(
target: String val,
atime: (I64 val , I64 val),
mtime: (I64 val , I64 val))
: Bool val
Parameters¶
Returns¶
- Bool val
symlink¶
Link the source path to the link_name, where the link_name is relative to this directory.
Parameters¶
Returns¶
- Bool val
remove¶
Remove the file or directory. The directory contents will be removed as well, recursively. Symlinks will be removed but not traversed.
Parameters¶
- target: String val
Returns¶
- Bool val
rename¶
Rename source (which is relative to this directory) to target (which is
relative to the to
directory).
Parameters¶
Returns¶
- Bool val
dispose¶
Close the directory.
Returns¶
- None val