mirror of
https://git.mirrors.martin98.com/https://github.com/gulrak/filesystem
synced 2025-06-11 02:36:33 +08:00
commit
c57242b4bc
@ -4201,6 +4201,13 @@ GHC_INLINE path current_path(std::error_code& ec)
|
|||||||
return path();
|
return path();
|
||||||
}
|
}
|
||||||
return path(std::wstring(buffer.get()), path::native_format);
|
return path(std::wstring(buffer.get()), path::native_format);
|
||||||
|
#elif defined(__GLIBC__)
|
||||||
|
std::unique_ptr<char, decltype(&std::free)> buffer { ::getcwd(NULL, 0), std::free };
|
||||||
|
if (buffer == nullptr) {
|
||||||
|
ec = detail::make_system_error();
|
||||||
|
return path();
|
||||||
|
}
|
||||||
|
return path(buffer.get());
|
||||||
#else
|
#else
|
||||||
size_t pathlen = static_cast<size_t>(std::max(int(::pathconf(".", _PC_PATH_MAX)), int(PATH_MAX)));
|
size_t pathlen = static_cast<size_t>(std::max(int(::pathconf(".", _PC_PATH_MAX)), int(PATH_MAX)));
|
||||||
std::unique_ptr<char[]> buffer(new char[pathlen + 1]);
|
std::unique_ptr<char[]> buffer(new char[pathlen + 1]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user