mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 20:47:45 +00:00
LibCore: Add Core::System::getcwd() wrapper
This commit is contained in:
parent
1c950773fb
commit
a62669ebcf
2 changed files with 12 additions and 0 deletions
|
@ -301,6 +301,17 @@ ErrorOr<String> gethostname()
|
|||
return String(&hostname[0]);
|
||||
}
|
||||
|
||||
ErrorOr<String> getcwd()
|
||||
{
|
||||
auto* cwd = ::getcwd(nullptr, 0);
|
||||
if (!cwd)
|
||||
return Error::from_syscall("getcwd"sv, -errno);
|
||||
|
||||
String string_cwd(cwd);
|
||||
free(cwd);
|
||||
return string_cwd;
|
||||
}
|
||||
|
||||
ErrorOr<void> ioctl(int fd, unsigned request, ...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue