Module: nupp.io.Path

Constructors and platform operations for immutable filesystem paths.

Module contents

Constructors

ConstructorDescription
newCreates a path by joining one or more components.

Functions

FunctionKindDescription
currentDirectoryfunctionReads the process's current working directory.
separatorfunctionReturns the current platform's primary path separator.

Constructors#

newconstructor#

Creates a path by joining one or more components.

Examples#

Build a path from components:

Normalize the path after joining its components:

local new: function(first: string, ...: string): Path

Arguments

NameTypeDescription
firststring

the first path component

...string

the remaining path components

Returns

TypeDescription
Path

the new path

Functions#

currentDirectoryfunction#

Reads the process's current working directory.

local currentDirectory: function(): (Path?, string?)

Returns

TypeDescription
Path?

the current directory, or nil on failure

string?

a failure reason, when unsuccessful

separatorfunction#

Returns the current platform's primary path separator.

local separator: function(): string

Returns

TypeDescription
string

the path separator