erm
This commit is contained in:
parent
a04a8ea901
commit
2cb836b125
1 changed files with 15 additions and 10 deletions
|
@ -1,8 +1,11 @@
|
||||||
#include "package.hpp"
|
#include "package.hpp"
|
||||||
|
|
||||||
|
#ifndef __serenity__
|
||||||
#include <SQLiteCpp/Database.h> // SQLite::{Database, OPEN_READONLY}
|
#include <SQLiteCpp/Database.h> // SQLite::{Database, OPEN_READONLY}
|
||||||
#include <SQLiteCpp/Exception.h> // SQLite::Exception
|
#include <SQLiteCpp/Exception.h> // SQLite::Exception
|
||||||
#include <SQLiteCpp/Statement.h> // SQLite::Statement
|
#include <SQLiteCpp/Statement.h> // SQLite::Statement
|
||||||
|
#endif // __serenity__
|
||||||
|
|
||||||
#include <chrono> // std::chrono
|
#include <chrono> // std::chrono
|
||||||
#include <filesystem> // std::filesystem
|
#include <filesystem> // std::filesystem
|
||||||
#include <format> // std::format
|
#include <format> // std::format
|
||||||
|
@ -137,6 +140,7 @@ namespace package {
|
||||||
return GetCountFromDirectoryImpl(pmId, dirPath, noFilter, false);
|
return GetCountFromDirectoryImpl(pmId, dirPath, noFilter, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __serenity__
|
||||||
fn GetCountFromDb(const PackageManagerInfo& pmInfo) -> Result<u64, DracError> {
|
fn GetCountFromDb(const PackageManagerInfo& pmInfo) -> Result<u64, DracError> {
|
||||||
const auto& [pmId, dbPath, countQuery] = pmInfo;
|
const auto& [pmId, dbPath, countQuery] = pmInfo;
|
||||||
const String cacheKey = "pkg_count_" + pmId; // More specific cache key
|
const String cacheKey = "pkg_count_" + pmId; // More specific cache key
|
||||||
|
@ -226,6 +230,7 @@ namespace package {
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
#endif // __serenity__
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
fn GetNixCount() -> Result<u64, DracError> {
|
fn GetNixCount() -> Result<u64, DracError> {
|
||||||
|
@ -246,7 +251,7 @@ namespace package {
|
||||||
|
|
||||||
return GetCountFromDb(nixInfo);
|
return GetCountFromDb(nixInfo);
|
||||||
}
|
}
|
||||||
#endif
|
#endif // __linux__ || __APPLE__
|
||||||
|
|
||||||
fn GetCargoCount() -> Result<u64, DracError> {
|
fn GetCargoCount() -> Result<u64, DracError> {
|
||||||
using util::helpers::GetEnv;
|
using util::helpers::GetEnv;
|
||||||
|
@ -302,7 +307,7 @@ namespace package {
|
||||||
|
|
||||||
#if defined(__linux__) || defined(__APPLE__)
|
#if defined(__linux__) || defined(__APPLE__)
|
||||||
futures.push_back(std::async(std::launch::async, GetNixCount));
|
futures.push_back(std::async(std::launch::async, GetNixCount));
|
||||||
#endif
|
#endif // __linux__ || __APPLE__
|
||||||
futures.push_back(std::async(std::launch::async, GetCargoCount));
|
futures.push_back(std::async(std::launch::async, GetCargoCount));
|
||||||
|
|
||||||
u64 totalCount = 0;
|
u64 totalCount = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue