Index: libcxx/src/filesystem/operations.cpp =================================================================== --- libcxx/src/filesystem/operations.cpp +++ libcxx/src/filesystem/operations.cpp @@ -1135,6 +1135,13 @@ path __current_path(error_code* ec) { ErrorHandler err("current_path", ec); +#if defined(_LIBCPP_WIN32API) + std::unique_ptr buff(::_wgetcwd(nullptr, 0), + &::free); + if (buff.get() == nullptr) + return err.report(capture_errno(), "call to _wgetcwd failed"); + return {buff.get()}; +#else auto size = ::pathconf(".", _PC_PATH_MAX); _LIBCPP_ASSERT(size >= 0, "pathconf returned a 0 as max size"); @@ -1144,6 +1151,7 @@ return err.report(capture_errno(), "call to getcwd failed"); return {buff.get()}; +#endif } void __current_path(const path& p, error_code* ec) {