The path
module provides functions for manipulating file paths and performing operations related to file paths.
Joins any number of path elements into a single path, separating them with the operating system-specific separator.
path1, path2, ...
: Multiplestring
objects representing the path elements to be joined.
Returns a string
containing the joined path.
Returns the last element of the path, typically the file or directory name.
path
: Astring
representing the path.
Returns a string
containing the base name.
Returns the file extension of the given path.
path
: Astring
representing the path.
Returns a string
containing the file extension.
Returns the cleaned version of the path.
path
: Astring
representing the path to be cleaned.
Returns a string
containing the cleaned path.
Returns the directory part of the given path.
path
: Astring
representing the path.
Returns a string
containing the directory part.
Checks whether the given path is absolute.
path
: Astring
representing the path.
Returns a bool
indicating whether the path is absolute.
Returns the absolute path of the given path.
path
: Astring
representing the path.
Returns a string
containing the absolute path.
Converts the path to use forward slashes ('/') as the separator.
path
: Astring
representing the path.
Returns a string
with forward slashes.
Converts the path to use the native operating system separator.
path
: Astring
representing the path.
Returns a string
with the native separator.
Returns the volume name of the given path.
path
: Astring
representing the path.
Returns a string
containing the volume name.
Walks the file tree rooted at the specified root path and returns a list of all visited files and directories.
root
: Astring
representing the root directory to start the walk.
Returns a array
containing a list of paths visited during the walk.
Splits the input string containing a list of paths into individual paths.
paths
: Astring
representing the list of paths.
Returns a array
containing individual path elements.
import "path"
// Join path elements
joined_path := path.join("folder", "hello.txt")
println(joined_path)