Reference

Path

Basename

Input A file path string.
Output The filename portion of the path.

Signature

path_basename(a: String): String

Example

path_basename("/home/user/file.txt") // returns "file.txt"

Dirname

Input A file path string.
Output The directory portion of the path.

Signature

path_dirname(a: String): String

Example

path_dirname("/home/user/file.txt") // returns "/home/user"

Extension

Input A file path string.
Output The file extension (including the dot).

Signature

path_extension(a: String): String

Example

path_extension("/home/user/file.txt") // returns ".txt"

Is Absolute

Input A file path string.
Output True if the path is absolute, false otherwise.

Signature

path_isAbsolute(a: String): Boolean

Example

path_isAbsolute("/home/user") // returns true

Join

Input Two path segments.
Output The path segments joined together with the appropriate separator.

Signature

path_join(a: String, b: String): String

Example

path_join("home/user", "file.txt") // returns "home/user/file.txt"

Normalize

Input A file path string.
Output The normalized path with redundant separators and segments removed.

Signature

path_normalize(a: String): String

Example

path_normalize("/home//user/../user/file.txt") // returns "/home/user/file.txt"