Module jls.io.Path

Provides a representation of a file system path name.

Usage:

    local configurationPath = File:new('work/configuration.json')
    configurationPath:getName() -- returns 'configuration.json'
    configurationPath:getParentPath():getName() -- returns 'work'
    

Class Path

Path:new ([parent], pathname) Creates a new Path representing the specified pathname.
path:getName () Returns the name of the file or directory of this Path.
path:getPathName () Returns the string representation of this Path.
path:toString () Returns the string representation of this Path.
path:getParent () Returns the parent path as a string.
path:getParentPath () Returns the parent of this path as a Path.
path:isAbsolute () Indicates whether or not this path is absolute.
Path.separator The Operating System (OS) specific separator, '/' on Unix and '\' on Windows.
Path.pathSeparator The Operating System (OS) specific path separator, ':' on Unix and ';' on Windows.


Class Path

A Path class. A Path instance represents a file or a directory.
Path:new ([parent], pathname)
Creates a new Path representing the specified pathname.

Parameters:

  • parent The optional parent as a string or a Path. (optional)
  • pathname string The name of the path.

Returns:

    a new Path

Usage:

    local workingDirectory = Path:new('work')
    local configurationPath = Path:new(workingDirectory, 'configuration.json')
path:getName ()
Returns the name of the file or directory of this Path. The name is the last last part of the path.

Returns:

    string the name of the file or directory.

Usage:

    local configurationPath = Path:new('work/configuration.json')
    configurationPath:getName() -- returns 'configuration.json'
path:getPathName ()
Returns the string representation of this Path. This is the creation value.

Returns:

    string the string representation of this Path.

Usage:

    local configurationPath = Path:new('work/configuration.json')
    configurationPath:getPathName() -- returns 'work/configuration.json'
path:toString ()
Returns the string representation of this Path.

Returns:

    string the string representation of this Path.

Usage:

    local configurationPath = Path:new('work/configuration.json')
    configurationPath:toString() -- returns 'work/configuration.json'
path:getParent ()
Returns the parent path as a string.

Returns:

    string the parent path.

Usage:

    local configurationPath = Path:new('work/configuration.json')
    configurationPath:getParent() -- returns 'work'
path:getParentPath ()
Returns the parent of this path as a Path.

Returns:

    Path the parent of this path as a Path.

Usage:

    local configurationPath = File:new('work/configuration.json')
    configurationPath:getParentPath():getName() -- returns 'work'
path:isAbsolute ()
Indicates whether or not this path is absolute.

Returns:

    boolean true when this path is absolute, false otherwise.
Path.separator
The Operating System (OS) specific separator, '/' on Unix and '\' on Windows.
Path.pathSeparator
The Operating System (OS) specific path separator, ':' on Unix and ';' on Windows.
generated by LDoc 1.4.6