This commit is contained in:
Mars 2025-05-04 18:02:56 -04:00
parent 8bd18187fc
commit f476aa6a94
Signed by: pupbrained
GPG key ID: 0FF5B8826803F895

View file

@ -3,20 +3,23 @@
// clang-format off
#include "src/core/package.hpp"
#include <fstream>
#include <unordered_set>
#include "src/util/defs.hpp"
#include "src/util/error.hpp"
#include "src/util/types.hpp"
// clang-format on
using util::error::DracError, util::error::DracErrorCode;
using util::types::u64, util::types::String, util::types::Result;
using util::types::u64, util::types::String, util::types::Result, util::types::Err;
namespace {
fn CountUniquePackages(const String& dbPath) -> Result<u64, DracError> {
std::ifstream dbFile(dbPath);
if (!dbFile.is_open())
return Err(DracError(DracErrorCode::NotFound, std::format("Failed to open file: {}", dbPath.string())));
return Err(DracError(DracErrorCode::NotFound, std::format("Failed to open file: {}", dbPath)));
std::unordered_set<String> uniquePackages;
String line;