1[[bbv2.reference.modules.path]] 2= path 3 4Performs various path manipulations. Paths are always in a 'normalized' 5representation. In it, a path may be either: 6 7* `'.'`, or 8* `['/'] [ ( '..' '/' )* (token '/')* token ]` 9 10In plain english, a path can be rooted, `'..'` elements are allowed only 11at the beginning, and it never ends in slash, except for the path 12consisting of slash only. 13 141. [[bbv2.reference.modules.path.make]] `rule make ( native )` 15+ 16Converts the native path into normalized form. 17 182. [[bbv2.reference.modules.path.native]] `rule native ( path )` 19+ 20Builds the native representation of the path. 21 223. [[bbv2.reference.modules.path.is-rooted]] `rule is-rooted ( path )` 23+ 24Tests if a path is rooted. 25 264. [[bbv2.reference.modules.path.has-parent]] `rule has-parent ( path )` 27+ 28Tests if a path has a parent. 29 305. [[bbv2.reference.modules.path.basename]] `rule basename ( path )` 31+ 32Returns the path without any directory components. 33 346. [[bbv2.reference.modules.path.parent]] `rule parent ( path )` 35+ 36Returns the parent directory of the path. If no parent exists, an error 37is issued. 38 397. [[bbv2.reference.modules.path.reverse]] `rule reverse ( path )` 40+ 41Returns `path2` such that `[ join path path2 ] = "."`. The path may not 42contain `".."` element or be rooted. 43 448. [[bbv2.reference.modules.path.join]] `rule join ( elements + )` 45+ 46Concatenates the passed path elements. Generates an error if any element 47other than the first one is rooted. Skips any empty or undefined path 48elements. 49 509. [[bbv2.reference.modules.path.root]] `rule root ( path root )` 51+ 52If `path` is relative, it is rooted at `root`. Otherwise, it is 53unchanged. 54 5510. [[bbv2.reference.modules.path.pwd]] `rule pwd ( )` 56+ 57Returns the current working directory. 58 5911. [[bbv2.reference.modules.path.glob]] `rule glob ( dirs * : patterns + : exclude-patterns * )` 60+ 61Returns the list of files matching the given pattern in the specified 62directory. Both directories and patterns are supplied as portable paths. 63Each pattern should be a non-absolute path, and can't contain "." or 64".." elements. Each slash separated element of a pattern can contain the 65following special characters: 66+ 67* '?' matches any character 68* '*' matches an arbitrary number of characters 69+ 70A file `$(d)/e1/e2/e3` (where 'd' is in `$(dirs)`) matches the pattern 71p1/p2/p3 if and only if e1 matches p1, e2 matches p2 and so on. For 72example: 73+ 74[source,jam] 75---- 76[ glob . : *.cpp ] 77[ glob . : */build/Jamfile ] 78---- 79 8012. [[bbv2.reference.modules.path.glob-tree]] `rule glob-tree ( roots * : patterns + : exclude-patterns * )` 81+ 82Recursive version of link:#bbv2.reference.modules.path.glob[glob]. 83Builds the glob of files while also searching in the subdirectories of 84the given roots. An optional set of exclusion patterns will filter out 85the matching entries from the result. The exclusions also apply to the 86subdirectory scanning, such that directories that match the exclusion 87patterns will not be searched. 88 8913. [[bbv2.reference.modules.path.exists]] `rule exists ( file )` 90+ 91Returns true if the specified file exists. 92 9314. [[bbv2.reference.modules.path.all-parents]] `rule all-parents ( path : upper_limit ? : cwd ? )` 94+ 95Find out the absolute name of path and return the list of all the 96parents, starting with the immediate one. Parents are returned as 97relative names. If `upper_limit` is specified, directories above it will 98be pruned. 99 10015. [[bbv2.reference.modules.path.glob-in-parents]] `rule glob-in-parents ( dir : patterns + : upper-limit ? )` 101+ 102Search for `patterns` in parent directories of `dir`, up to and 103including `upper_limit`, if it is specified, or till the filesystem root 104otherwise. 105 10616. [[bbv2.reference.modules.path.relative]] `rule relative ( child parent : no-error ? )` 107+ 108Assuming `child` is a subdirectory of `parent`, return the relative path 109from `parent` to `child`. 110 11117. [[bbv2.reference.modules.path.relative-to]] `rule relative-to ( path1 path2 )` 112+ 113Returns the minimal path to path2 that is relative path1. 114 11518. [[bbv2.reference.modules.path.programs-path]] `rule programs-path ( )` 116+ 117Returns the list of paths which are used by the operating system for 118looking up programs. 119 12019. [[bbv2.reference.modules.path.makedirs]] `rule makedirs ( path )` 121+ 122Creates a directory and all parent directories that do not already 123exist. 124