mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-07-21 17:04:24 +08:00
refs #63, work on issues with wchar and clang in windows.
This commit is contained in:
parent
9a047b9f8d
commit
a5cadd2e50
@ -1676,6 +1676,14 @@ inline path::path(const std::string_view& source, format fmt)
|
|||||||
_path = detail::toUtf8(std::string(source));
|
_path = detail::toUtf8(std::string(source));
|
||||||
postprocess_path_with_format(_path, fmt);
|
postprocess_path_with_format(_path, fmt);
|
||||||
}
|
}
|
||||||
|
#ifdef GHC_USE_WCHAR_T
|
||||||
|
template <>
|
||||||
|
inline path::path(const std::wstring_view& source, format fmt)
|
||||||
|
{
|
||||||
|
_path = detail::toUtf8(std::wstring(source).c_str());
|
||||||
|
postprocess_path_with_format(_path, fmt);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <class Source, typename>
|
template <class Source, typename>
|
||||||
@ -4506,9 +4514,9 @@ GHC_INLINE space_info space(const path& p, std::error_code& ec) noexcept
|
|||||||
{
|
{
|
||||||
ec.clear();
|
ec.clear();
|
||||||
#ifdef GHC_OS_WINDOWS
|
#ifdef GHC_OS_WINDOWS
|
||||||
ULARGE_INTEGER freeBytesAvailableToCaller = {0, 0};
|
ULARGE_INTEGER freeBytesAvailableToCaller = {{0, 0}};
|
||||||
ULARGE_INTEGER totalNumberOfBytes = {0, 0};
|
ULARGE_INTEGER totalNumberOfBytes = {{0, 0}};
|
||||||
ULARGE_INTEGER totalNumberOfFreeBytes = {0, 0};
|
ULARGE_INTEGER totalNumberOfFreeBytes = {{0, 0}};
|
||||||
if (!GetDiskFreeSpaceExW(detail::fromUtf8<std::wstring>(p.u8string()).c_str(), &freeBytesAvailableToCaller, &totalNumberOfBytes, &totalNumberOfFreeBytes)) {
|
if (!GetDiskFreeSpaceExW(detail::fromUtf8<std::wstring>(p.u8string()).c_str(), &freeBytesAvailableToCaller, &totalNumberOfBytes, &totalNumberOfFreeBytes)) {
|
||||||
ec = detail::make_system_error();
|
ec = detail::make_system_error();
|
||||||
return {static_cast<uintmax_t>(-1), static_cast<uintmax_t>(-1), static_cast<uintmax_t>(-1)};
|
return {static_cast<uintmax_t>(-1), static_cast<uintmax_t>(-1), static_cast<uintmax_t>(-1)};
|
||||||
|
@ -2628,13 +2628,28 @@ TEST_CASE("30.10.15.39 weakly_canonical", "[filesystem][operations][fs.op.weakly
|
|||||||
TEST_CASE("std::string_view support", "[filesystem][fs.string_view]")
|
TEST_CASE("std::string_view support", "[filesystem][fs.string_view]")
|
||||||
{
|
{
|
||||||
#if __cpp_lib_string_view
|
#if __cpp_lib_string_view
|
||||||
std::string p("foo/bar");
|
{
|
||||||
std::string_view sv(p);
|
std::string p("foo/bar");
|
||||||
CHECK(fs::path(sv, fs::path::format::generic_format).generic_string() == "foo/bar");
|
std::string_view sv(p);
|
||||||
fs::path p2("fo");
|
CHECK(fs::path(sv, fs::path::format::generic_format).generic_string() == "foo/bar");
|
||||||
p2 += std::string_view("o");
|
fs::path p2("fo");
|
||||||
CHECK(p2 == "foo");
|
p2 += std::string_view("o");
|
||||||
CHECK(p2.compare(std::string_view("foo")) == 0);
|
CHECK(p2 == "foo");
|
||||||
|
CHECK(p2.compare(std::string_view("foo")) == 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
#if defined(IS_WCHAR_PATH) || defined(GHC_USE_WCHAR_T)
|
||||||
|
{
|
||||||
|
std::wsting p(L"foo/bar");
|
||||||
|
std::wstring_view sv(p);
|
||||||
|
CHECK(fs::path(sv, fs::path::format::generic_format).generic_string() == "foo/bar");
|
||||||
|
fs::path p2(L"fo");
|
||||||
|
p2 += std::wstring_view(L"o");
|
||||||
|
CHECK(p2 == "foo");
|
||||||
|
CHECK(p2.compare(std::wstring_view(L"foo")) == 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#else
|
#else
|
||||||
WARN("std::string_view specific tests are empty without std::string_view.");
|
WARN("std::string_view specific tests are empty without std::string_view.");
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user