diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-10-13 18:20:35 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-11-04 08:12:47 +0200 |
commit | ae579402c8c64ea8ceea2e9fcee5097b3c53e353 (patch) | |
tree | 5933a00f434adab5583e81c147754d5d4dc69f12 /build2/utility | |
parent | 8d2e541ab1aa24140eb680fb046e49a4a3f0bbd2 (diff) |
Minor dependency cleanup
Diffstat (limited to 'build2/utility')
-rw-r--r-- | build2/utility | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/build2/utility b/build2/utility index 396c79e..99e79cc 100644 --- a/build2/utility +++ b/build2/utility @@ -80,6 +80,36 @@ namespace build2 next_word (const string&, size_t n, size_t& b, size_t& e, char d1 = ' ', char d2 = '\0'); + // Work/home directories (must be initialized in main()) and relative path + // calculation. + // + extern dir_path work; + extern dir_path home; + + // By default this points to work. Setting this to something else should + // only be done in tightly controlled, non-concurrent situations (e.g., + // state dump). If it is empty, then relative() below returns the original + // path. + // + extern const dir_path* relative_base; + + // If possible and beneficial, translate an absolute, normalized path into + // relative to the relative_base directory, which is normally work. Note + // that if the passed path is the same as relative_base, then this function + // returns empty path. + // + template <typename K> + basic_path<char, K> + relative (const basic_path<char, K>&); + + // In addition to calling relative(), this function also uses shorter + // notations such as '~/'. For directories the result includes the trailing + // slash. If the path is the same as base, returns "./" if current is true + // and empty string otherwise. + // + string + diag_relative (const path&, bool current = true); + // Basic process utilities. // |