path (ex_stdlib v0.2.0)
View SourcePath manipulation.
This module provides functions for manipulating file system paths in a cross-platform manner. It handles both Unix-style and Windows-style paths appropriately.
Examples:
AbsPath = path:absname("../relative/path"),
JoinedPath = path:join(["/home", "user", "documents"]),
BaseName = path:basename("/path/to/file.txt"),
DirName = path:dirname("/path/to/file.txt").
Summary
Functions
Returns the absolute name of the given path.
Returns the absolute name of the given path relative to the specified directory.
Returns the basename of the given path.
Returns the basename of the given path with the specified extension removed.
Returns the directory part of the given path.
Expands a path by resolving any environment variables and tildes.
Expands a path relative to the specified directory.
Returns the extension of the given path.
Joins a list of path components into a single path.
Joins two path components into a single path.
Returns the given path relative to the specified directory.
Returns the given path relative to the current working directory.
Returns the path with the extension removed.
Returns the path with the specified extension removed.
Splits a path into its components.
Returns the type of the given path.
Returns a list of files matching the given wildcard pattern.
Returns a list of files matching the given wildcard pattern in the specified directory.
Types
Functions
Returns the absolute name of the given path.
Converts a relative path to an absolute path using the current working directory.
Returns the absolute name of the given path relative to the specified directory.
Converts a relative path to an absolute path using the given directory as base.
Returns the basename of the given path.
The basename is the last component of the path after the last directory separator.
Returns the basename of the given path with the specified extension removed.
If the basename ends with the given extension, it is removed.
Returns the directory part of the given path.
Returns all components of the path except the last one.
Expands a path by resolving any environment variables and tildes.
Environment variables are specified as $VAR or ${VAR}. Tilde (~) is expanded to the user's home directory.
Expands a path relative to the specified directory.
First expands the path, then makes it relative to the given directory.
Returns the extension of the given path.
The extension includes the dot (e.g., ".txt"). Returns an empty string if there is no extension.
Joins a list of path components into a single path.
Uses the appropriate path separator for the current platform.
Joins two path components into a single path.
Uses the appropriate path separator for the current platform.
Returns the given path relative to the specified directory.
If the path is not under the given directory, returns the path unchanged.
Returns the given path relative to the current working directory.
Converts an absolute path to a relative path from the current directory.
Returns the path with the extension removed.
If there is no extension, returns the path unchanged.
Returns the path with the specified extension removed.
Only removes the extension if it matches the given extension.
Splits a path into its components.
Returns a list of path components.
Returns the type of the given path.
Returns absolute for absolute paths, relative for relative paths, and volumerelative for Windows volume-relative paths.
Returns a list of files matching the given wildcard pattern.
Uses the current working directory as the base.
Returns a list of files matching the given wildcard pattern in the specified directory.
Uses the given directory as the base for pattern matching.