Path

The nova.path global object is used to manipulate file system paths.

Methods

basename(path)

Returns the last component (the filename) of the specified path, including any extension.

dirname(path)

Returns the directory parent of the path.

extname(path)

Returns the file extension of the path. If the path has no file extension, this method returns an empty string.

splitext(path)

Splits the path into an array with two components: the path + filename without the extension, and the file extension.

expanduser(path)

Expands any reference to the user’s home directory using the ~ component to contain the full home directory path.

isAbsolute(path)

Returns true if the path is an absolute path.

join(path, …)

Combines one or more components into one path using the platform’s proper path components.

normalize(path)

Attempts to normalize a path by expanding symbolic links and other ambiguous components.

relative(from, to)

Calculates and returns a relative path between two other paths, inserting .. components as necessary.

Added in Nova 8.

split(path)

Splits the path into an array of path components (split on the ‘/’ separator), but including the leading ‘/’ root for absolute paths.