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.

class ref Directory

Constructors

create

new ref create(
  from: FilePath val)
: Directory ref^ ?

Parameters

Returns


_relative

new iso _relative(
  path': FilePath val,
  fd': I32 val)
: Directory iso^

Parameters

Returns


Public fields


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 "..".

fun box entries()
: Array[String val] iso^ ?

Returns


open

Open a directory relative to this one. Raises an error if the path is not within this directory hierarchy.

fun box open(
  target: String val)
: Directory iso^ ?

Parameters

Returns


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.

fun box mkdir(
  target: String val)
: Bool val

Parameters

Returns


create_file

Open for read/write, creating if it doesn't exist, preserving the contents if it does exist.

fun box create_file(
  target: String val)
: File iso^ ?

Parameters

Returns


open_file

Open for read only, failing if it doesn't exist.

fun box open_file(
  target: String val)
: File iso^ ?

Parameters

Returns


info

Return a FileInfo for this directory. Raise an error if the fd is invalid or if we don't have FileStat permission.

fun box info()
: FileInfo val ?

Returns


chmod

Set the FileMode for this directory.

fun box chmod(
  mode: FileMode box)
: Bool val

Parameters

Returns


chown

Set the owner and group for this directory. Does nothing on Windows.

fun box chown(
  uid: U32 val,
  gid: U32 val)
: Bool val

Parameters

Returns


touch

Set the last access and modification times of the directory to now.

fun box touch()
: Bool val

Returns


set_time

Set the last access and modification times of the directory to the given values.

fun box set_time(
  atime: (I64 val , I64 val),
  mtime: (I64 val , I64 val))
: Bool val

Parameters

Returns


infoat

Return a FileInfo for some path relative to this directory.

fun box infoat(
  target: String val)
: FileInfo val ?

Parameters

Returns


chmodat

Set the FileMode for some path relative to this directory.

fun box chmodat(
  target: String val,
  mode: FileMode box)
: Bool val

Parameters

Returns


chownat

Set the FileMode for some path relative to this directory.

fun box chownat(
  target: String val,
  uid: U32 val,
  gid: U32 val)
: Bool val

Parameters

Returns


touchat

Set the last access and modification times of the directory to now.

fun box touchat(
  target: String val)
: Bool val

Parameters

Returns


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


Link the source path to the link_name, where the link_name is relative to this directory.

fun box symlink(
  source: FilePath val,
  link_name: String val)
: Bool val

Parameters

Returns


remove

Remove the file or directory. The directory contents will be removed as well, recursively. Symlinks will be removed but not traversed.

fun box remove(
  target: String val)
: Bool val

Parameters

Returns


rename

Rename source (which is relative to this directory) to target (which is relative to the to directory).

fun box rename(
  source: String val,
  to: Directory box,
  target: String val)
: Bool val

Parameters

Returns


dispose

Close the directory.

fun ref dispose()
: None val

Returns


Private Functions

_final

Close the file descriptor.

fun box _final()
: None val

Returns