FilePath

A FilePath represents a capability to access a path. The path will be represented as an absolute path and a set of capabilities for operations on that path.

class val FilePath

Constructors

create

new val create(
  base: (FilePath val | AmbientAuth val),
  path': String val,
  caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val = seq)
: FilePath val^ ?

Parameters

Returns


mkdtemp

new val mkdtemp(
  base: (FilePath val | AmbientAuth val),
  prefix: String val = seq,
  caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val = seq)
: FilePath val^ ?

Parameters

Returns


_create

new val _create(
  path': String val,
  caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val)
: FilePath val^

Parameters

Returns


Public fields



Public Functions

join

Return a new path relative to this one.

fun val join(
  path': String val,
  caps': Flags[(FileCreate val | FileChmod val | FileChown val | FileLink val | FileLookup val | FileMkdir val | FileRead val | FileRemove val | FileRename val | FileSeek val | FileStat val | FileSync val | FileTime val | FileTruncate val | FileWrite val | FileExec val), U32 val] val = seq)
: FilePath val ?

Parameters

Returns


walk

Walks a directory structure starting at this.

handler(dir_path, dir_entries) will be called for each directory starting with this one. The handler can control which subdirectories are expanded by removing them from the dir_entries list.

fun val walk(
  handler: WalkHandler ref,
  follow_links: Bool val = seq)
: None val

Parameters

Returns


canonical

Return the equivalent canonical absolute path. Raise an error if there isn't one.

fun val canonical()
: FilePath val ?

Returns


exists

Returns true if the path exists. Returns false for a broken symlink.

fun val exists()
: Bool val

Returns


mkdir

Creates the directory. Will recursively create each element. Returns true if the directory exists when we're done, false if it does not. If we do not have the FileStat permission, this will return false even if the directory does exist.

fun val mkdir(
  must_create: Bool val = seq)
: Bool val

Parameters

  • must_create: Bool val = seq

Returns


remove

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

fun val remove()
: Bool val

Returns


rename

Rename a file or directory.

fun box rename(
  new_path: FilePath val)
: Bool val

Parameters

Returns


Create a symlink to a file or directory.

fun box symlink(
  link_name: FilePath val)
: Bool val

Parameters

Returns


chmod

Set the FileMode for a path.

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

Parameters

Returns


chown

Set the owner and group for a path. 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 a path to now.

fun box touch()
: Bool val

Returns


set_time

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

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

Parameters

Returns