From 71f9c1ce63d0b6ec68f2e8d92927845ed306a1ee Mon Sep 17 00:00:00 2001 From: pupbrained Date: Sun, 4 May 2025 00:15:28 -0400 Subject: [PATCH] more pkg stuff --- src/os/haiku.cpp | 11 +---------- src/os/linux.cpp | 5 ----- src/os/linux/pkg_count.cpp | 3 --- src/os/macos.cpp | 4 +++- src/os/os.hpp | 10 ---------- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/src/os/haiku.cpp b/src/os/haiku.cpp index 5e44c42..9dc2ee6 100644 --- a/src/os/haiku.cpp +++ b/src/os/haiku.cpp @@ -261,8 +261,6 @@ namespace os { } fn GetPackageCount() -> Result { - u64 count = 0; - BPackageKit::BPackageRoster roster; BPackageKit::BPackageInfoSet packageList; @@ -271,14 +269,7 @@ namespace os { if (status != B_OK) return Err(DracError(DracErrorCode::ApiUnavailable, "Failed to get active package list")); - count += static_cast(packageList.CountInfos()); - - if (Result sharedCount = shared::GetPackageCount()) - count += *sharedCount; - else - debug_at(sharedCount.error()); - - return count; + return static_cast(packageList.CountInfos()); } } // namespace os diff --git a/src/os/linux.cpp b/src/os/linux.cpp index 1085c66..1b22c9a 100644 --- a/src/os/linux.cpp +++ b/src/os/linux.cpp @@ -480,11 +480,6 @@ namespace os { else debug_at(linuxCount.error()); - if (Result sharedCount = shared::GetPackageCount()) - count += *sharedCount; - else - debug_at(sharedCount.error()); - return count; } } // namespace os diff --git a/src/os/linux/pkg_count.cpp b/src/os/linux/pkg_count.cpp index 5f28285..5ce2b7c 100644 --- a/src/os/linux/pkg_count.cpp +++ b/src/os/linux/pkg_count.cpp @@ -9,10 +9,7 @@ #include // std::chrono::{duration_cast, seconds, system_clock} #include // std::filesystem::{current_path, directory_entry, directory_iterator, etc.} #include // std::format -#include // std::{ifstream, ofstream} #include // std::{async, launch} -#include // std::ios::{binary, trunc}, std::ios_base -#include // std::istreambuf_iterator #include // glz::read_beve #include // glz::write_beve #include // std::error_code diff --git a/src/os/macos.cpp b/src/os/macos.cpp index 232a896..97ad2a2 100644 --- a/src/os/macos.cpp +++ b/src/os/macos.cpp @@ -222,7 +222,9 @@ fn os::GetDiskUsage() -> Result { .total_bytes = vfs.f_blocks * vfs.f_frsize }; } -fn os::GetPackageCount() -> Result { return shared::GetPackageCount(); } +fn os::GetPackageCount() -> Result { + return Err(DracError(DracErrorCode::NotSupported, "Package count is not supported on macOS")); // TODO: Implement +} fn os::GetShell() -> Result { return "Fish"; // TODO: Implement diff --git a/src/os/os.hpp b/src/os/os.hpp index 237e407..ad9609e 100644 --- a/src/os/os.hpp +++ b/src/os/os.hpp @@ -100,14 +100,4 @@ namespace os { * or a DracError on failure (e.g., filesystem not found, permission error). */ fn GetDiskUsage() -> Result; - - namespace shared { - /** - * @brief Gets the number of installed packages from OS-agnostic package managers. - * @details Currently only supports Cargo package manager. - * @return A Result containing the package count (u64) on success, - * or a DracError on failure (e.g., permission errors, command not found). - */ - fn GetPackageCount() -> Result; - } // namespace shared } // namespace os