File

Path: /src/type/file.coffee compiled to /lib/type/file.js

Check the value as valid file or directory entry.

Sanitize options:

  • basedir - String relative paths are calculated from this directory
  • resolve - Boolean should the given value be resolved to a full path

Check options:

  • exists - Boolean true to check for already existing entry
  • find - Array|Function list of directories in which to search for the file
  • filetype - String check against inode type: f, file, d, dir, directory, l, link

Schema Specification

File is a file schema definition.

An object with the following keys allowed: basedir, resolve, exists, find, filetype, title, description, key, type, optional, default. The following entries have a specific format:

basedir

Base Directory is the directory to use for relative link resolving.

A text entry which is optional and will be set to '.' if not specified. All control characters will be removed.

resolve

Resolve is a flag to resolve relative links to absolute ones.

A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.

exists

Exists are a flag if the file have to exist.

A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.

find

Find is the directories in which to search for the file.

A list which is optional. Each entry has to be of type string:

Find Directories are the directories in which to search for the file.

A text entry in which all control characters will be removed.

filetype

File Type is the type, the file should have.

A text entry which is optional. All control characters will be removed. The text will get lower case. Only the values: ‘f’, ‘file’, ‘d’, ‘dir’, ‘directory’, ‘l’, ‘link’, ‘fifo’, ‘pipe’, ‘p’, ‘socket’, ‘s’ are allowed.

title

Title is the title used to describe the element.

A text entry which is optional. All control characters will be removed.

description

Description is the free description of the element.

A text entry which is optional. All control characters will be removed.

key

Binding to Keyname is the mapping to which key names in an object this element belongs.

A valid regular expression which is optional. It has to be one of the following types:

  • An object which has to be an instance of class RegExp.
  • A text entry in which all control characters will be removed. The text should match: /^/.?/[gim]$/.
type

Type is the type of element.

A text entry in which all control characters will be removed.

optional

Optional is a flag defining if this element is optional.

A boolean value, which will be true for ‘true’, ‘1’, ‘on’, ‘yes’, ‘+’, 1, true and will be considered as false for ‘false’, ‘0’, ‘off’, ‘no’, ‘-’, 0, false. It’s optional.

default

Default Value is the default value to use if nothing given.

A text entry which is optional. All control characters will be removed.