PlatformPath

sealed external interface PlatformPath(source)

Properties

Link copied to clipboard

The platform-specific file delimiter. ';' or ':'.

Link copied to clipboard
abstract val posix: PlatformPath

Posix specific pathing. Same as parent object on posix.

Link copied to clipboard
abstract val sep: PlatformPathSep

The platform-specific file separator. '\\' or '/'.

Link copied to clipboard
abstract val win32: PlatformPath

Windows specific pathing. Same as parent object on windows

Functions

Link copied to clipboard
abstract fun basename(path: String, suffix: String = definedExternally): String

Return the last portion of a path. Similar to the Unix basename command. Often used to extract the file name from a fully qualified path.

Link copied to clipboard
abstract fun dirname(path: String): String

Return the directory name of a path. Similar to the Unix dirname command.

Link copied to clipboard
abstract fun extname(path: String): String

Return the extension of the path, from the last '.' to end of string in the last portion of the path. If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string.

Link copied to clipboard
abstract fun format(pathObject: FormatInputPathObject): String

Returns a path string from an object - the opposite of parse().

Link copied to clipboard
abstract fun isAbsolute(path: String): Boolean

Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory.

Link copied to clipboard
abstract fun join(vararg paths: String): String

Join all arguments together and normalize the resulting path.

Link copied to clipboard
abstract fun matchesGlob(path: String, pattern: String): Boolean

The path.matchesGlob() method determines if path matches the pattern.

Link copied to clipboard
abstract fun normalize(path: String): String

Normalize a string path, reducing '..' and '.' parts. When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used.

Link copied to clipboard
abstract fun parse(path: String): ParsedPath

Returns an object from a path string - the opposite of format().

Link copied to clipboard
abstract fun relative(from: String, to: String): String

Solve the relative path from {from} to {to} based on the current working directory. At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve.

Link copied to clipboard
abstract fun resolve(vararg paths: String): String

The right-most parameter is considered {to}. Other parameters are considered an array of {from}.

Link copied to clipboard
abstract fun toNamespacedPath(path: String): String

On Windows systems only, returns an equivalent namespace-prefixed path for the given path. If path is not a string, path will be returned without modifications. This method is meaningful only on Windows system. On POSIX systems, the method is non-operational and always returns path without modifications.