6 namespace fs = std::filesystem;
12 if (path.is_absolute()) {
16 const fs::path root_abs = fs::absolute(root);
18 const fs::path root_dir =
19 fs::exists(root_abs) && !fs::is_directory(root_abs) ? root_abs.parent_path() : root_abs;
22 const fs::path resolved_path = fs::weakly_canonical(root_dir / path);
27 fs::path
resolve_paths(
const fs::path& root,
const std::initializer_list<fs::path>& paths)
29 fs::path p_ret = root;
31 for (
const fs::path& p : paths) {
39 const std::filesystem::path& root,
40 const std::filesystem::path& path)
fs::path resolve_path(const fs::path &root, const fs::path &path)
fs::path resolve_paths(const fs::path &root, const std::initializer_list< fs::path > &paths)
std::filesystem::path resolve_path_if_not_empty(const std::filesystem::path &root, const std::filesystem::path &path)
Wraps resolve_path() but returns path directly if it is empty.