Namespace: path

gpf. path

Root namespace for path manipulation.

As the library works with several hosts (Windows and Unix-like, see Loading GPF Library), the API accepts any kind of path separator. However, they can't be mixed.

When giving a path, the rule is:

  • If the path contains at least one , it is considered a Windows one
  • Otherwise, the path is considered a Unix one

On the other hand, all path returned by the API are using the Unix-like formalism.

Since:
  • 0.1.9

Methods


<static> extension(path)

Get the extension of the last name of a path (including dot)

Parameters:
Name Type Description
path String

Path to analyze

Since:
  • 0.1.9
Returns:

Extension (including dot)

Type
String

<static> join(path, relativePath)

Join all arguments together and normalize the resulting path

Parameters:
Name Type Argument Description
path String

Base path

relativePath String <repeatable>

Relative parts to append to the base path

Since:
  • 0.1.9
Throws:
Returns:

Joined path

Type
String

<static> name(path)

Get the last name of a path

Parameters:
Name Type Description
path String

Path to analyze

Since:
  • 0.1.9
Returns:

Name

Type
String

<static> nameOnly(path)

Get the last name of a path without the extension

Parameters:
Name Type Description
path String

Path to analyze

Since:
  • 0.1.9
Returns:

Name without the extension

Type
String

<static> parent(path)

Get the parent of a path

Parameters:
Name Type Description
path String

Path to analyze

Since:
  • 0.1.9
Throws:
Returns:

Parent path

Type
String

<static> relative(from, to)

Solve the relative path from from to to

Parameters:
Name Type Description
from String

From path

to String

To path

Since:
  • 0.1.9
Returns:

Relative path

Type
String