API Docs for: 0.8.2
Show:

PathDriver Class

A utility library for processing file paths. Handles any type of file path so long as the separator is "/"

For ItemMirror core developers only. Enable protected to see.

Methods

_stripLeadingSlash

(
  • path
)
String private

Parameters:

Returns:

String:

The path without any leading slash

_stripTrailingSlash

(
  • path
)
String private

Parameters:

Returns:

String:

The path without any trailing slash

formatPath

(
  • path
)
String protected

Formats a path by removing any trailing slashes.

Parameters:

  • path String

    The path to be formatted

Returns:

String:

The well formatted path

Example:

format('/foo/bar/');
// returns '/foo/bar'

getPathSeparator

() String protected

Returns:

String:

The character that is used as a path separator

Example:

getPathSeparator();
// returns '/'

isRoot

(
  • path
)
Boolean protected

Parameters:

  • path String

    Path to test for root

Returns:

Boolean:

True if root, false otherwise

Example:

format('/');
// returns true, anything else will return false

joinPath

(
  • root
  • leaf
)
String protected

Takes two paths and joins them together.

Parameters:

  • root String

    The root path to join

  • leaf String

    The leaf path to join

Returns:

String:

The two joined paths

Example:

joinPath('/foo/', '/bar/');
// returns '/foo/bar/'

joinPathArrays

() protected

Takes an array of paths and joins them all together.

Currently unimplemented and throws notImplemented exception if called.

splitPath

(
  • path
)
[String] protected

Splits a path into an array of the different folders in that path; including the root if present.

Parameters:

  • path String

    The path to be split

Returns:

[String]:

An array of split up paths

Example:

joinPath('/foo/bar/baz');
// returns ['', 'foo', 'bar', 'baz']