updated build system
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
@ -43,6 +43,8 @@ inline constexpr const std::string_view directory_seperator{backslash};
|
||||
inline constexpr const std::wstring_view directory_seperator_w{backslash_w};
|
||||
inline constexpr const std::string_view not_directory_seperator{slash};
|
||||
inline constexpr const std::wstring_view not_directory_seperator_w{slash_w};
|
||||
inline constexpr const std::string_view unc_notation{"\\\\"};
|
||||
inline constexpr const std::wstring_view unc_notation_w{L"\\\\"};
|
||||
#else // !defined(_WIN32)
|
||||
inline constexpr const std::string_view directory_seperator{slash};
|
||||
inline constexpr const std::wstring_view directory_seperator_w{slash_w};
|
||||
@ -177,6 +179,24 @@ get_slash<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||
return slash_w;
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
template <typename char_t>
|
||||
[[nodiscard]] inline constexpr auto
|
||||
get_unc_notation() -> std::basic_string_view<char_t>;
|
||||
|
||||
template <>
|
||||
[[nodiscard]] inline constexpr auto
|
||||
get_unc_notation<char>() -> std::basic_string_view<char> {
|
||||
return unc_notation;
|
||||
}
|
||||
|
||||
template <>
|
||||
[[nodiscard]] inline constexpr auto
|
||||
get_unc_notation<wchar_t>() -> std::basic_string_view<wchar_t> {
|
||||
return unc_notation_w;
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
template <typename string_t>
|
||||
[[nodiscard]] inline auto get_current_path() -> string_t;
|
||||
|
||||
@ -332,6 +352,11 @@ template <typename string_t>
|
||||
get_not_directory_seperator<typename string_t::value_type>());
|
||||
|
||||
#if defined(_WIN32)
|
||||
auto unc_notation_t = get_unc_notation<typename string_t::value_type>();
|
||||
if (utils::string::begins_with(fmt_path, unc_notation_t)) {
|
||||
return fmt_path;
|
||||
}
|
||||
|
||||
auto dot_t = get_dot<typename string_t::value_type>();
|
||||
auto dot_sep_t = string_t{dot_t} + dir_sep_t;
|
||||
if (fmt_path == dot_t || fmt_path == dot_sep_t) {
|
||||
@ -385,9 +410,15 @@ format_path(string_t &path,
|
||||
utils::string::replace(path, not_sep, sep);
|
||||
|
||||
#if defined(_WIN32)
|
||||
auto is_unc{false};
|
||||
auto long_notation_t = get_long_notation<typename string_t::value_type>();
|
||||
auto unc_notation_t = get_unc_notation<typename string_t::value_type>();
|
||||
if (utils::string::begins_with(path, long_notation_t)) {
|
||||
path = path.substr(long_notation_t.size());
|
||||
} else if (utils::string::begins_with(path, unc_notation_t)) {
|
||||
path = path.substr(unc_notation_t.size());
|
||||
utils::string::left_trim(path, sep.at(0U));
|
||||
is_unc = true;
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
||||
@ -401,7 +432,9 @@ format_path(string_t &path,
|
||||
}
|
||||
|
||||
#if defined(_WIN32)
|
||||
if ((path.size() >= 2U) && (path.at(1U) == ':')) {
|
||||
if (is_unc) {
|
||||
path = string_t{unc_notation_t} + path;
|
||||
} else if ((path.size() >= 2U) && (path.at(1U) == ':')) {
|
||||
path[0U] = utils::string::to_lower(string_t(1U, path.at(0U))).at(0U);
|
||||
}
|
||||
#endif // defined(_WIN32)
|
||||
|
Reference in New Issue
Block a user