FixIO Documentation

Back to summary

import "io/file";

Path class

Path to file or directory.

Supported operators: + with Path and String types (for merging).
A short variant of the constructors is available: Path(...)

Initialization

static function create(path: String): Path
Creates a new path object for given path string.
static function create(path: String, child: String): Path
Creates a new path object as concatetation of given path strings.
static function get_current(): Path
Returns path of current working directory.
static function get_roots(): String[]
Returns list of roots (device letters on Windows, just "/" on other platforms).

Operations

function merge(child: Path or String): Path
Merges two paths and returns the result.
function create_directory()
Creates a directory.
function create_directories()
Creates a directory if needed as well as any parent directories if not present.
function delete_file()
Deletes a file.
function delete_directory()
Deletes a directory.

Properties

function get_file_name(): String
Returns the file name represented by this path (or null in case it's not a valid file name).
function get_parent(): Path
Returns path to parent directory.
function is_absolute(): Boolean
Returns true when the path is absolute.
function is_relative(): Boolean
Returns true when the path is relative.
function is_root(): Boolean
Returns true when the path is referring to root.
function is_empty(): Boolean
Returns true when the path is empty relative path.
function get_absolute(): Path
Returns absolute path.
function get_files(): Path[]
Returns list of paths to files in a directory.
function get_file_names(): String[]
Returns list of file names in a directory.
function exists(): Boolean
Returns whether a file or directory exists for this path.
function is_file(): Boolean
Returns true when the path is referring to a file.
function is_directory(): Boolean
Returns true when the path is referring to a directory.
function is_special(): Boolean
Returns true when the path is referring to a special file.
function is_symlink(): Boolean
Returns true when the path is referring to a symbolic link.
function get_length(): Long
Returns the length of the file referred by this path.
function get_modification_time(): Long
Returns the modification time of the file referred by this path in seconds since the UNIX epoch (1970-01-01 00:00:00 UTC).
function get_symlink(): Path
Returns the symbolic link value.
function to_string(): String
Returns the string representation of the path.