generated from Sithas/conan_template
Вынесена функция 2
(cherry picked from commit e23977fdf0c870d677f37902b3ad0de23dc67e12)
This commit is contained in:
@@ -53,4 +53,25 @@ boost::beast::string_view MimeType(boost::beast::string_view path) {
|
||||
return "image/svg+xml";
|
||||
return "application/text";
|
||||
}
|
||||
|
||||
std::string PathCat(boost::beast::string_view base, boost::beast::string_view path){
|
||||
if (base.empty())
|
||||
return std::string(path);
|
||||
std::string result(base);
|
||||
#ifdef BOOST_MSVC
|
||||
char constexpr path_separator = '\\';
|
||||
if (result.back() == path_separator)
|
||||
result.resize(result.size() - 1);
|
||||
result.append(path.data(), path.size());
|
||||
for (auto &c : result)
|
||||
if (c == '/')
|
||||
c = path_separator;
|
||||
#else
|
||||
char constexpr path_separator = '/';
|
||||
if (result.back() == path_separator)
|
||||
result.resize(result.size() - 1);
|
||||
result.append(path.data(), path.size());
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
namespace uad {
|
||||
boost::beast::string_view MimeType(boost::beast::string_view path);
|
||||
|
||||
std::string PathCat(boost::beast::string_view base, boost::beast::string_view path);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user