summaryrefslogtreecommitdiffstats
path: root/src/detection/packages/packages.h
blob: f0d42004ded6bfcaff093f60be4a1908901d140f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once

#include "fastfetch.h"
#include "modules/packages/option.h"

typedef struct FFPackagesResult {
    uint32_t amSystem;
    uint32_t amUser;
    uint32_t apk;
    uint32_t appimage;
    uint32_t brew;
    uint32_t brewCask;
    uint32_t cards;
    uint32_t choco;
    uint32_t dpkg;
    uint32_t emerge;
    uint32_t eopkg;
    uint32_t flatpakSystem;
    uint32_t flatpakUser;
    uint32_t guixHome;
    uint32_t guixSystem;
    uint32_t guixUser;
    uint32_t hpkgSystem;
    uint32_t hpkgUser;
    uint32_t kiss;
    uint32_t linglong;
    uint32_t lpkg;
    uint32_t lpkgbuild;
    uint32_t macports;
    uint32_t moss;
    uint32_t mport;
    uint32_t nixDefault;
    uint32_t nixSystem;
    uint32_t nixUser;
    uint32_t opkg;
    uint32_t pacman;
    uint32_t pacstall;
    uint32_t paludis;
    uint32_t pisi;
    uint32_t pkg;
    uint32_t pkgsrc;
    uint32_t pkgtool;
    uint32_t rpm;
    uint32_t scoopGlobal;
    uint32_t scoopUser;
    uint32_t snap;
    uint32_t soar;
    uint32_t sorcery;
    uint32_t winget;
    uint32_t xbps;

    uint32_t all; // Make sure this goes last

    FFstrbuf pacmanBranch;
} FFPackagesResult;

#if FF_PACKAGES_REMOVE_DISABLED
    #define FF_PACKAGES_IS_ENABLED(options, pkgName) ({ (void) options; !((FF_PACKAGES_DISABLE_LIST) & (FF_PACKAGES_FLAG_ ## pkgName ## _BIT)); })
#else
    #define FF_PACKAGES_IS_ENABLED(options, pkgName) (!((options)->disabled & (FF_PACKAGES_FLAG_ ## pkgName ## _BIT)))
#endif

const char* ffDetectPackages(FFPackagesResult* result, FFPackagesOptions* options);
bool ffPackagesReadCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, const char* filePath, const char* packageId, uint32_t* result);
bool ffPackagesWriteCache(FFstrbuf* cacheDir, FFstrbuf* cacheContent, uint32_t num_elements);

#if defined(__linux__) || defined(__APPLE__) || defined(__GNU__)
uint32_t ffPackagesGetNix(FFstrbuf* baseDir, const char* dirname);
#endif
#ifndef _WIN32
uint32_t ffPackagesGetNumElements(const char* dirname, bool isdir);
#endif