mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-30 09:33:39 +01:00
Better BSD support
This commit is contained in:
+14
-3
@@ -13,7 +13,7 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#define FF_PACKAGES_MODULE_NAME "Packages"
|
||||
#define FF_PACKAGES_NUM_FORMAT_ARGS 15
|
||||
#define FF_PACKAGES_NUM_FORMAT_ARGS 16
|
||||
|
||||
typedef struct PackageCounts
|
||||
{
|
||||
@@ -25,6 +25,7 @@ typedef struct PackageCounts
|
||||
uint32_t nixSystem;
|
||||
uint32_t nixDefault;
|
||||
uint32_t apk;
|
||||
uint32_t pkg;
|
||||
uint32_t flatpak;
|
||||
uint32_t snap;
|
||||
uint32_t brew;
|
||||
@@ -319,7 +320,7 @@ static void getPackageCounts(const FFinstance* instance, FFstrbuf* baseDir, Pack
|
||||
FF_UNUSED(instance);
|
||||
#endif
|
||||
|
||||
#ifndef __APPLE__ //Linux desktop and Anrdoid
|
||||
#ifndef __APPLE__ //Linux desktop and Android
|
||||
|
||||
uint32_t baseDirLength = baseDir->length;
|
||||
|
||||
@@ -392,6 +393,14 @@ static void getPackageCounts(const FFinstance* instance, FFstrbuf* baseDir, Pack
|
||||
packageCounts->port += getMacPortsPackages(baseDir);
|
||||
|
||||
#endif // __APPLE__
|
||||
|
||||
#ifdef __FreeBSD__
|
||||
|
||||
ffStrbufAppendS(baseDir, "/var/db/pkg/local.sqlite");
|
||||
packageCounts->pkg += (uint32_t) ffSettingsGetSQLite3Int(instance, baseDir->chars, "SELECT count(id) FROM packages");
|
||||
ffStrbufSubstrBefore(baseDir, baseDirLength);
|
||||
|
||||
#endif // __FreeBSD__
|
||||
}
|
||||
|
||||
static void getPackageCountsBedrock(const FFinstance* instance, FFstrbuf* baseDir, PackageCounts* packageCounts)
|
||||
@@ -458,7 +467,7 @@ void ffPrintPackages(FFinstance* instance)
|
||||
|
||||
ffStrbufDestroy(&baseDir);
|
||||
|
||||
uint32_t all = counts.pacman + counts.dpkg + counts.rpm + counts.emerge + counts.xbps + counts.nixSystem + nixUser + counts.nixDefault + counts.apk + counts.flatpak + counts.snap + counts.brew + counts.port;
|
||||
uint32_t all = counts.pacman + counts.dpkg + counts.rpm + counts.emerge + counts.xbps + counts.nixSystem + nixUser + counts.nixDefault + counts.apk + counts.pkg + counts.flatpak + counts.snap + counts.brew + counts.port;
|
||||
if(all == 0)
|
||||
{
|
||||
ffPrintError(instance, FF_PACKAGES_MODULE_NAME, 0, &instance->config.packages, "No packages from known package managers found");
|
||||
@@ -513,6 +522,7 @@ void ffPrintPackages(FFinstance* instance)
|
||||
}
|
||||
|
||||
FF_PRINT_PACKAGE(apk)
|
||||
FF_PRINT_PACKAGE(pkg)
|
||||
FF_PRINT_PACKAGE(flatpak)
|
||||
FF_PRINT_PACKAGE(snap)
|
||||
FF_PRINT_PACKAGE(brew)
|
||||
@@ -539,6 +549,7 @@ void ffPrintPackages(FFinstance* instance)
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &nixUser},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &counts.nixDefault},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &counts.apk},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &counts.pkg},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &counts.flatpak},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &counts.snap},
|
||||
{FF_FORMAT_ARG_TYPE_UINT, &counts.brew},
|
||||
|
||||
Reference in New Issue
Block a user