diff options
author | Joel Rosdahl <joel@rosdahl.net> | 2020-02-19 20:33:46 +0100 |
---|---|---|
committer | Joel Rosdahl <joel@rosdahl.net> | 2020-02-23 21:07:12 +0100 |
commit | cd3d3ae2d327d304fa9c493377ca5cf1dd730ffc (patch) | |
tree | 96c02707d3b2e9ef193a7a55d9f2a60184757572 /src/Util.hpp | |
parent | eaab86a5c3a02adbc9b9f1d9346a433698b17b8d (diff) | |
download | ccache-cd3d3ae2d327d304fa9c493377ca5cf1dd730ffc.tar.gz ccache-cd3d3ae2d327d304fa9c493377ca5cf1dd730ffc.tar.bz2 ccache-cd3d3ae2d327d304fa9c493377ca5cf1dd730ffc.zip |
C++-ify get_relative_path
Diffstat (limited to 'src/Util.hpp')
-rw-r--r-- | src/Util.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/Util.hpp b/src/Util.hpp index 3f6b3be4..447f7f88 100644 --- a/src/Util.hpp +++ b/src/Util.hpp @@ -147,6 +147,13 @@ void get_level_1_files(const std::string& dir, const ProgressReceiver& progress_receiver, std::vector<std::shared_ptr<CacheFile>>& files); +// Compute a relative path from `dir` (an absolute path to a directory) to +// `path` (an absolute path). Assumes that both `dir` and `path` are normalized. +// The algorithm does *not* follow symlinks, so the result may not actually +// resolve to the same file as `path`. +std::string get_relative_path(nonstd::string_view dir, + nonstd::string_view path); + // Join `cache_dir`, a '/', `name`, and `suffix` into a single path and return // it. Additionally `levels` single-character, '/'-separated subpaths are split // from the beginning of `name` before joining them all. |