File System

pub struct EnvVariable {
  name: text,
  value: text
}

Types and functions for reading and writing files. A File value is obtained via file() and carries the path, format, and an internal reference. An environment variable as a name/value pair.

pub enum Format {
  TextFile,
  LittleEndian,
  BigEndian,
  Directory,
  NotExists
}
pub enum FileResult {
  Ok,
  NotFound,
  PermissionDenied,
  IsDirectory,
  NotDirectory,
  Other
}
pub fn ok(self: FileResult) -> boolean
pub struct File {
  path: text,

  size: long,

  format: Format,

  ref: i32,

  current: long,

  next: long
}
pub fn content(self: File) -> text
pub fn lines(self: File) -> vector < text >

Returns the platform path separator character: '\' on Windows, '/' elsewhere. Detected once at startup from the runtime filesystem.

pub fn path_sep() -> character
pub fn file(path: text) -> File
pub fn exists(path: text) -> boolean
pub fn exists(both: File) -> boolean

Method form: f = file("path"); if f.exists() { ... } Also callable as exists(file_obj) via the 'both' parameter name.

pub fn delete(path: text) -> FileResult
pub fn move(from: text, to: text) -> FileResult
pub fn mkdir(path: text) -> FileResult
pub fn mkdir_all(path: text) -> FileResult
pub fn set_file_size(self: File, size: long) -> FileResult
pub fn files(self: File) -> vector < File >
pub fn write(self: File, v: text)