This commit is contained in:
Mars 2025-05-03 22:33:08 -04:00
parent 17e356513f
commit 6ce7ab2b83
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895

View file

@ -4,13 +4,14 @@
#include <format> // std::format #include <format> // std::format
#include <fstream> // std::ifstream #include <fstream> // std::ifstream
#include <glaze/core/common.hpp> // glz::object #include <glaze/core/common.hpp> // glz::object
#include <glaze/core/context.hpp> // glz::error_ctx, glz::error_code #include <glaze/core/context.hpp> // glz::{error_ctx, error_code}
#include <glaze/core/meta.hpp> // glz::detail::Object #include <glaze/core/meta.hpp> // glz::detail::Object
#include <glaze/core/read.hpp> // glz::read #include <glaze/core/read.hpp> // glz::read
#include <glaze/core/reflect.hpp> // glz::format_error
#include <glaze/json/read.hpp> // glz::read<glaze_opts>
#include <iterator> // std::istreambuf_iterator #include <iterator> // std::istreambuf_iterator
#include <pwd.h> // getpwuid, struct passwd #include <pwd.h> // getpwuid, passwd
#include <string> // std::string (String) #include <string> // std::string (String)
#include <string_view> // std::string_view (StringView)
#include <sys/statvfs.h> // statvfs #include <sys/statvfs.h> // statvfs
#include <sys/types.h> // uid_t #include <sys/types.h> // uid_t
#include <sys/utsname.h> // utsname, uname #include <sys/utsname.h> // utsname, uname
@ -96,8 +97,8 @@ namespace os {
fn GetDesktopEnvironment() -> Result<String, DracError> { return "SerenityOS Desktop"; } fn GetDesktopEnvironment() -> Result<String, DracError> { return "SerenityOS Desktop"; }
fn GetShell() -> Result<String, DracError> { fn GetShell() -> Result<String, DracError> {
uid_t userId = getuid(); uid_t userId = getuid();
struct passwd* pw = getpwuid(userId); passwd* pw = getpwuid(userId);
if (pw == nullptr) if (pw == nullptr)
return Err(DracError(DracErrorCode::NotFound, std::format("User ID {} not found in /etc/passwd", userId))); return Err(DracError(DracErrorCode::NotFound, std::format("User ID {} not found in /etc/passwd", userId)));