diff --git a/Libraries/LibCore/SystemWindows.cpp b/Libraries/LibCore/SystemWindows.cpp index a791a5f2138..991f1d31743 100644 --- a/Libraries/LibCore/SystemWindows.cpp +++ b/Libraries/LibCore/SystemWindows.cpp @@ -126,6 +126,17 @@ ErrorOr getcwd() return string_cwd; } +ErrorOr chdir(StringView path) +{ + if (path.is_null()) + return Error::from_errno(EFAULT); + + ByteString path_string = path; + if (::_chdir(path_string.characters()) < 0) + return Error::from_syscall("chdir"sv, errno); + return {}; +} + ErrorOr stat(StringView path) { if (path.is_null())