Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions stl/inc/filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -3013,17 +3013,15 @@ namespace filesystem {
// calls GetFullPathNameW
_Ec.clear(); // for exception safety
path _Result;
if (!_Input._Text.empty()) {
_Result._Text.resize(__std_fs_max_path);
for (;;) {
const auto _Requested_size = static_cast<unsigned long>(_Result._Text.size());
const auto _Full_path_result =
__std_fs_get_full_path_name(_Input._Text.c_str(), _Requested_size, _Result._Text.data());
_Result._Text.resize(_Full_path_result._Size);
if (_Full_path_result._Size < _Requested_size) {
_Ec = _Make_ec(_Full_path_result._Error);
break;
}
_Result._Text.resize(__std_fs_max_path);
for (;;) {
const auto _Requested_size = static_cast<unsigned long>(_Result._Text.size());
const auto _Full_path_result =
__std_fs_get_full_path_name(_Input._Text.c_str(), _Requested_size, _Result._Text.data());
_Result._Text.resize(_Full_path_result._Size);
if (_Full_path_result._Size < _Requested_size) {
_Ec = _Make_ec(_Full_path_result._Error);
break;
}
}
return _Result;
Expand Down
6 changes: 3 additions & 3 deletions tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -736,6 +736,9 @@ std/iterators/iterator.requirements/iterator.assoc.types/readable.traits/indirec
# Not analyzed, likely bogus test. constexpr fails with "vector iterators incompatible".
std/ranges/range.adaptors/range.join.with/range.join.with.iterator/ctor.default.pass.cpp FAIL

# libc++ treats `fs::absolute("", ec)` as a success case, whereas we emit an error and return an empty `path`.
std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp FAIL

# Problems in this test:
# - Clang does not trap on ARM64, but MSVC does.
# - The test inspects `__x86_64__` and `__i386__`, which MSVC doesn't define.
Expand Down Expand Up @@ -1140,9 +1143,6 @@ std/input.output/filesystems/class.path/path.member/path.generic.obs/generic_str
# Not analyzed. Assertion failed: std::equal(p.begin(), p.end(), TC.elements.begin(), ComparePathExact())
std/input.output/filesystems/class.path/path.member/path.decompose/path.decompose.pass.cpp FAIL

# Not analyzed. Assertion failed: ret.is_absolute()
std/input.output/filesystems/fs.op.funcs/fs.op.absolute/absolute.pass.cpp FAIL

# Not analyzed. Assertion failed: ret == TC.p
std/input.output/filesystems/fs.op.funcs/fs.op.temp_dir_path/temp_directory_path.pass.cpp FAIL

Expand Down
8 changes: 7 additions & 1 deletion tests/std/tests/P0218R1_filesystem/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,13 @@ void test_absolute() {
longPath.resize(260);
expect_absolute(longPath, longPath);

expect_absolute({}, {});
EXPECT(absolute(L"", ec).empty());
if (ec.value() != 123) {
wcerr << L"Warning: Expected absolute on an empty path to report ERROR_INVALID_NAME, "
L"but it reported "
<< ec.value() << L"\n";
}
EXPECT(ec.category() == system_category());
}

void test_canonical() {
Expand Down