Refactored handling of relative paths (#213)

This commit is contained in:
Bartek Kryza
2023-12-08 08:17:00 +01:00
parent f1d3695ccc
commit d7195d5a5d
130 changed files with 317 additions and 255 deletions

View File

@@ -435,6 +435,17 @@ std::string path_to_url(const std::filesystem::path &p);
std::filesystem::path ensure_path_is_absolute(const std::filesystem::path &p,
const std::filesystem::path &root = std::filesystem::current_path());
/**
* @brief Check if a given path is relative to another path.
*
* @param parent The path to be checked for relativity.
* @param right The base path against which the relativity is checked.
* @return True if the child path is relative to the parent path, false
* otherwise.
*/
bool is_relative_to(
const std::filesystem::path &parent, const std::filesystem::path &child);
std::string format_message_comment(
const std::string &c, unsigned width = kDefaultMessageCommentWidth);