updated build system
Some checks failed
BlockStorage/repertory/pipeline/head There was a failure building this commit

This commit is contained in:
2024-08-02 18:45:17 -05:00
parent dd492ff52d
commit a3e578240b
2 changed files with 78 additions and 23 deletions

View File

@@ -269,27 +269,35 @@ combine(std::wstring path,
template <typename string_t>
[[nodiscard]] inline auto create_api_path_t(
std::basic_string_view<typename string_t::value_type> path) -> string_t {
static auto backslash_t = get_backslash<typename string_t::value_type>();
static auto dot_slash_t = get_dot_slash<typename string_t::value_type>();
static auto dot_t = get_dot<typename string_t::value_type>();
static auto slash_t = get_slash<typename string_t::value_type>();
auto backslash_t = get_backslash<typename string_t::value_type>();
auto dot_t = get_dot<typename string_t::value_type>();
auto dot_slash_t = get_dot_slash<typename string_t::value_type>();
auto slash_t = get_slash<typename string_t::value_type>();
if (path.empty() || (path == dot_t) || (path == slash_t)) {
if (path.empty() || path == backslash_t || path == dot_t ||
path == dot_slash_t || path == slash_t) {
return string_t{slash_t};
}
string_t api_path{path};
#if defined(_WIN32)
if ((api_path.size() >= 2U) && (api_path.at(1U) == ':')) {
api_path = api_path.substr(2U);
}
#endif // defined(_WIN32)
while (utils::string::begins_with(api_path, dot_slash_t)) {
api_path = api_path.substr(dot_slash_t.size());
}
while (utils::string::begins_with(api_path, dot_t)) {
api_path = api_path.substr(dot_t.size());
}
format_path(api_path, slash_t, backslash_t);
if (api_path.find(dot_slash_t) == 0) {
api_path = api_path.substr(1U);
}
if (api_path.at(0U) != '/') {
api_path = string_t{slash_t} + api_path;
}
if ((api_path != slash_t) && utils::string::ends_with(api_path, slash_t)) {
utils::string::right_trim(api_path, '/');
if (api_path.at(0U) != slash_t.at(0U)) {
return string_t{slash_t} + api_path;
}
return api_path;
@@ -347,14 +355,6 @@ template <typename string_t>
format_path(fmt_path,
get_directory_seperator<typename string_t::value_type>(),
get_not_directory_seperator<typename string_t::value_type>());
#if defined(_WIN32)
if ((fmt_path.size() >= 2U) && (fmt_path.at(1U) == ':')) {
fmt_path[0U] =
utils::string::to_lower(string_t{1U, fmt_path.at(0U)}).at(0U);
}
#endif // defined(_WIN32)
return fmt_path;
}
@@ -374,11 +374,21 @@ format_path(string_t &path,
-> string_t & {
utils::string::replace(path, not_sep, sep);
string_t double_sep{2U, sep.at(0U)};
string_t double_sep(2U, sep.at(0U));
while (utils::string::contains(path, double_sep)) {
utils::string::replace(path, double_sep, sep);
}
if (path != sep) {
utils::string::right_trim(path, sep.at(0U));
}
#if defined(_WIN32)
if ((path.size() >= 2U) && (path.at(1U) == ':')) {
path[0U] = utils::string::to_lower(string_t{1U, path.at(0U)}).at(0U);
}
#endif // defined(_WIN32)
return path;
}
@@ -396,6 +406,7 @@ template <typename string_t>
if (ret == slash_t) {
return ret;
}
return utils::string::right_trim(ret, '/');
}