updated build system
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
All checks were successful
BlockStorage/repertory/pipeline/head This commit looks good
This commit is contained in:
parent
3238b6d4de
commit
f1f9e4547d
@ -53,50 +53,50 @@ inline constexpr const std::wstring_view not_directory_seperator_w{backslash_w};
|
|||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_backslash()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_backslash() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_backslash<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_backslash<char>() -> std::basic_string_view<char> {
|
||||||
return backslash;
|
return backslash;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_backslash<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_backslash<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return backslash_w;
|
return backslash_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_directory_seperator()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_directory_seperator() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_directory_seperator<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_directory_seperator<char>() -> std::basic_string_view<char> {
|
||||||
return directory_seperator;
|
return directory_seperator;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_directory_seperator<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_directory_seperator<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return directory_seperator_w;
|
return directory_seperator_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_not_directory_seperator()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_not_directory_seperator() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_not_directory_seperator<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_not_directory_seperator<char>() -> std::basic_string_view<char> {
|
||||||
return not_directory_seperator;
|
return not_directory_seperator;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_not_directory_seperator<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_not_directory_seperator<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return not_directory_seperator_w;
|
return not_directory_seperator_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,95 +104,95 @@ template <typename char_t>
|
|||||||
[[nodiscard]] inline constexpr auto get_dot() -> std::basic_string_view<char_t>;
|
[[nodiscard]] inline constexpr auto get_dot() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_dot<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_dot<char>() -> std::basic_string_view<char> {
|
||||||
return dot;
|
return dot;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_dot<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_dot<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return dot_w;
|
return dot_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_dot_backslash()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_dot_backslash() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_dot_backslash<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_dot_backslash<char>() -> std::basic_string_view<char> {
|
||||||
return dot_backslash;
|
return dot_backslash;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_dot_backslash<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_dot_backslash<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return dot_backslash_w;
|
return dot_backslash_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_dot_slash()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_dot_slash() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_dot_slash<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_dot_slash<char>() -> std::basic_string_view<char> {
|
||||||
return dot_slash;
|
return dot_slash;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_dot_slash<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_dot_slash<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return dot_slash_w;
|
return dot_slash_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_long_notation()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_long_notation() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_long_notation<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_long_notation<char>() -> std::basic_string_view<char> {
|
||||||
return long_notation;
|
return long_notation;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_long_notation<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_long_notation<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return long_notation_w;
|
return long_notation_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_slash()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_slash() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_slash<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_slash<char>() -> std::basic_string_view<char> {
|
||||||
return slash;
|
return slash;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_slash<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_slash<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return slash_w;
|
return slash_w;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
template <typename char_t>
|
template <typename char_t>
|
||||||
[[nodiscard]] inline constexpr auto get_unc_notation()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char_t>;
|
get_unc_notation() -> std::basic_string_view<char_t>;
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_unc_notation<char>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<char> {
|
get_unc_notation<char>() -> std::basic_string_view<char> {
|
||||||
return unc_notation;
|
return unc_notation;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
[[nodiscard]] inline constexpr auto get_unc_notation<wchar_t>()
|
[[nodiscard]] inline constexpr auto
|
||||||
-> std::basic_string_view<wchar_t> {
|
get_unc_notation<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||||
return unc_notation_w;
|
return unc_notation_w;
|
||||||
}
|
}
|
||||||
#endif // defined(_WIN32)
|
#endif // defined(_WIN32)
|
||||||
@ -204,13 +204,13 @@ template <typename string_t>
|
|||||||
|
|
||||||
[[nodiscard]] auto absolute(std::wstring_view path) -> std::wstring;
|
[[nodiscard]] auto absolute(std::wstring_view path) -> std::wstring;
|
||||||
|
|
||||||
[[nodiscard]] inline auto combine(std::string_view path,
|
[[nodiscard]] inline auto
|
||||||
const std::vector<std::string_view> &paths)
|
combine(std::string_view path,
|
||||||
-> std::string;
|
const std::vector<std::string_view> &paths) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] inline auto combine(std::wstring_view path,
|
[[nodiscard]] inline auto
|
||||||
const std::vector<std::wstring_view> &paths)
|
combine(std::wstring_view path,
|
||||||
-> std::wstring;
|
const std::vector<std::wstring_view> &paths) -> std::wstring;
|
||||||
|
|
||||||
[[nodiscard]] auto contains_trash_directory(std::string_view path) -> bool;
|
[[nodiscard]] auto contains_trash_directory(std::string_view path) -> bool;
|
||||||
|
|
||||||
@ -242,28 +242,28 @@ format_path(string_t &path,
|
|||||||
std::basic_string_view<typename string_t::value_type> not_sep)
|
std::basic_string_view<typename string_t::value_type> not_sep)
|
||||||
-> string_t &;
|
-> string_t &;
|
||||||
|
|
||||||
[[nodiscard]] inline auto get_parent_api_path(std::string_view path)
|
[[nodiscard]] inline auto
|
||||||
-> std::string;
|
get_parent_api_path(std::string_view path) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] inline auto get_parent_api_path(std::wstring_view path)
|
[[nodiscard]] inline auto
|
||||||
-> std::wstring;
|
get_parent_api_path(std::wstring_view path) -> std::wstring;
|
||||||
|
|
||||||
[[nodiscard]] auto get_parent_path(std::string_view path) -> std::string;
|
[[nodiscard]] auto get_parent_path(std::string_view path) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] auto get_parent_path(std::wstring_view path) -> std::wstring;
|
[[nodiscard]] auto get_parent_path(std::wstring_view path) -> std::wstring;
|
||||||
|
|
||||||
[[nodiscard]] inline auto get_parts(std::string_view path)
|
[[nodiscard]] inline auto
|
||||||
-> std::vector<std::string>;
|
get_parts(std::string_view path) -> std::vector<std::string>;
|
||||||
|
|
||||||
[[nodiscard]] inline auto get_parts_w(std::wstring_view path)
|
[[nodiscard]] inline auto
|
||||||
-> std::vector<std::wstring>;
|
get_parts_w(std::wstring_view path) -> std::vector<std::wstring>;
|
||||||
|
|
||||||
[[nodiscard]] auto get_relative_path(std::string_view path,
|
[[nodiscard]] auto get_relative_path(std::string_view path,
|
||||||
std::string_view root_path) -> std::string;
|
std::string_view root_path) -> std::string;
|
||||||
|
|
||||||
[[nodiscard]] auto get_relative_path(std::wstring_view path,
|
[[nodiscard]] auto
|
||||||
std::wstring_view root_path)
|
get_relative_path(std::wstring_view path,
|
||||||
-> std::wstring;
|
std::wstring_view root_path) -> std::wstring;
|
||||||
|
|
||||||
[[nodiscard]] auto make_file_uri(std::string_view path) -> std::string;
|
[[nodiscard]] auto make_file_uri(std::string_view path) -> std::string;
|
||||||
|
|
||||||
@ -301,16 +301,15 @@ inline auto combine(std::string_view path,
|
|||||||
return combine_t<std::string>(path, paths);
|
return combine_t<std::string>(path, paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto combine(std::wstring_view path,
|
inline auto
|
||||||
const std::vector<std::wstring_view> &paths)
|
combine(std::wstring_view path,
|
||||||
-> std::wstring {
|
const std::vector<std::wstring_view> &paths) -> std::wstring {
|
||||||
return combine_t<std::wstring>(path, paths);
|
return combine_t<std::wstring>(path, paths);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename string_t>
|
template <typename string_t>
|
||||||
[[nodiscard]] inline auto
|
[[nodiscard]] inline auto create_api_path_t(
|
||||||
create_api_path_t(std::basic_string_view<typename string_t::value_type> path)
|
std::basic_string_view<typename string_t::value_type> path) -> string_t {
|
||||||
-> string_t {
|
|
||||||
auto backslash_t = get_backslash<typename string_t::value_type>();
|
auto backslash_t = get_backslash<typename string_t::value_type>();
|
||||||
auto dot_backslash_t = get_dot_backslash<typename string_t::value_type>();
|
auto dot_backslash_t = get_dot_backslash<typename string_t::value_type>();
|
||||||
auto dot_slash_t = get_dot_slash<typename string_t::value_type>();
|
auto dot_slash_t = get_dot_slash<typename string_t::value_type>();
|
||||||
@ -358,9 +357,8 @@ inline auto create_api_path(std::wstring_view path) -> std::wstring {
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename string_t>
|
template <typename string_t>
|
||||||
[[nodiscard]] inline auto
|
[[nodiscard]] inline auto finalize_t(
|
||||||
finalize_t(std::basic_string_view<typename string_t::value_type> path)
|
std::basic_string_view<typename string_t::value_type> path) -> string_t {
|
||||||
-> string_t {
|
|
||||||
string_t dir_sep_t{get_directory_seperator<typename string_t::value_type>()};
|
string_t dir_sep_t{get_directory_seperator<typename string_t::value_type>()};
|
||||||
string_t fmt_path{path};
|
string_t fmt_path{path};
|
||||||
if (fmt_path.empty()) {
|
if (fmt_path.empty()) {
|
||||||
@ -484,17 +482,19 @@ template <typename string_t>
|
|||||||
std::basic_string_view<typename string_t::value_type> path) -> string_t {
|
std::basic_string_view<typename string_t::value_type> path) -> string_t {
|
||||||
auto slash_t = get_slash<typename string_t::value_type>();
|
auto slash_t = get_slash<typename string_t::value_type>();
|
||||||
|
|
||||||
if (path == slash_t) {
|
string_t ret{path};
|
||||||
|
utils::string::right_trim(ret, slash_t.at(0U));
|
||||||
|
|
||||||
|
if (ret == slash_t || ret.empty()) {
|
||||||
return string_t{path};
|
return string_t{path};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto sub_path = path.substr(0, path.rfind(slash_t) + 1);
|
auto sub_path = ret.substr(0, ret.rfind(slash_t) + 1);
|
||||||
if (sub_path == slash_t) {
|
if (sub_path == slash_t) {
|
||||||
return string_t{sub_path};
|
return string_t{sub_path};
|
||||||
}
|
}
|
||||||
|
|
||||||
string_t ret{sub_path};
|
return sub_path;
|
||||||
return utils::string::right_trim(ret, slash_t.at(0U));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline auto get_parent_api_path(std::string_view path) -> std::string {
|
inline auto get_parent_api_path(std::string_view path) -> std::string {
|
||||||
|
@ -264,6 +264,23 @@ TEST(utils_path, create_api_path) {
|
|||||||
EXPECT_STREQ("/.state/.local", s.c_str());
|
EXPECT_STREQ("/.state/.local", s.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST(utils_path, get_parent_api_path) {
|
||||||
|
auto s = utils::path::get_parent_api_path("");
|
||||||
|
EXPECT_STREQ("/", s.c_str());
|
||||||
|
|
||||||
|
s = utils::path::get_parent_api_path("/");
|
||||||
|
EXPECT_STREQ("/", s.c_str());
|
||||||
|
|
||||||
|
s = utils::path::get_parent_api_path("/moose");
|
||||||
|
EXPECT_STREQ("/", s.c_str());
|
||||||
|
|
||||||
|
s = utils::path::get_parent_api_path("/moose/cow");
|
||||||
|
EXPECT_STREQ("/moose", s.c_str());
|
||||||
|
|
||||||
|
s = utils::path::get_parent_api_path("/moose/cow/");
|
||||||
|
EXPECT_STREQ("/moose", s.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
TEST(utils_path, finalize) {
|
TEST(utils_path, finalize) {
|
||||||
auto s = utils::path::finalize("");
|
auto s = utils::path::finalize("");
|
||||||
EXPECT_STREQ("", s.c_str());
|
EXPECT_STREQ("", s.c_str());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user