pathpathmodule
Performs various path manipulations. Paths are always in a 'normalized'
representation. In it, a path may be either:
'.', or['/'] [ ( '..' '/' )* (token '/')* token ]
In plain english, a path can be rooted, '..'
elements are allowed only at the beginning, and it never
ends in slash, except for the path consisting of slash only.
makepathrule make ( native )Converts the native path into normalized form.nativerule native ( path )Builds the native representation of the path.is-rootedrule is-rooted ( path )Tests if a path is rooted.has-parentrule has-parent ( path )Tests if a path has a parent.basenamerule basename ( path )Returns the path without any directory components.parentrule parent ( path )Returns the parent directory of the path. If no parent exists, an error is issued.reverserule reverse ( path )
Returns path2 such that
[ join path path2 ] = ".".
The path may not contain ".."
element or be rooted.
joinrule join ( elements + )
Concatenates the passed path elements. Generates an error if any
element other than the first one is rooted. Skips any empty or
undefined path elements.
rootrule root ( path root )
If path is relative, it is rooted at
root. Otherwise, it is unchanged.
pwdrule pwd ( )Returns the current working directory.globrule glob ( dirs * : patterns + : exclude-patterns * )
Returns the list of files matching the given pattern in the specified
directory. Both directories and patterns are supplied as portable paths. Each
pattern should be a non-absolute path, and can't contain "." or ".." elements.
Each slash separated element of a pattern can contain the following special
characters:
'?' matches any character'*' matches an arbitrary number of characters
A file $(d)/e1/e2/e3 (where 'd' is in $(dirs)) matches the pattern p1/p2/p3 if and
only if e1 matches p1, e2 matches p2 and so on.
For example:
[ glob . : *.cpp ]
[ glob . : */build/Jamfile ]
glob-treerule glob-tree ( roots * : patterns + : exclude-patterns * )
Recursive version of glob.
Builds the glob of files while also searching in
the subdirectories of the given roots. An optional set of exclusion patterns
will filter out the matching entries from the result. The exclusions also
apply to the subdirectory scanning, such that directories that match the
exclusion patterns will not be searched.
existsrule exists ( file )Returns true if the specified file exists.all-parentsrule all-parents ( path : upper_limit ? : cwd ? )
Find out the absolute name of path and return the list of all the parents,
starting with the immediate one. Parents are returned as relative names. If
upper_limit is specified, directories above it
will be pruned.
glob-in-parentsrule glob-in-parents ( dir : patterns + : upper-limit ? )
Search for patterns in parent directories
of dir, up to and including
upper_limit, if it is specified, or
till the filesystem root otherwise.
relativerule relative ( child parent : no-error ? )
Assuming child is a subdirectory of
parent, return the relative path from
parent to child.
relative-torule relative-to ( path1 path2 )Returns the minimal path to path2 that is relative path1.programs-pathrule programs-path ( )
Returns the list of paths which are used by the operating system for
looking up programs.
mkdirsrule makedirs ( path )
Creates a directory and all parent directories that do not
already exist.