mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-04 04:04:17 +01:00
Packages (Linux): add install-release package count support (#2342)
* feat: add install-release package count support * Apply suggestion from @codacy-production[bot] Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com> * Fix formatting of ffParsePropFileValues call --------- Co-authored-by: Carter Li <CarterLi@users.noreply.github.com> Co-authored-by: codacy-production[bot] <61871480+codacy-production[bot]@users.noreply.github.com>
This commit is contained in:
@@ -22,6 +22,7 @@ typedef struct FFPackagesResult {
|
||||
uint32_t guixUser;
|
||||
uint32_t hpkgSystem;
|
||||
uint32_t hpkgUser;
|
||||
uint32_t installrelease;
|
||||
uint32_t kiss;
|
||||
uint32_t linglong;
|
||||
uint32_t lpkg;
|
||||
|
||||
@@ -676,4 +676,19 @@ void ffDetectPackagesImpl(FFPackagesResult* result, FFPackagesOptions* options)
|
||||
result->appimage += getNumElementsBySuffix(&baseDir, "/AppImages", ".appimage");
|
||||
result->appimage += getNumElementsBySuffix(&baseDir, "/Applications", ".appimage");
|
||||
}
|
||||
|
||||
if (!(options->disabled & FF_PACKAGES_FLAG_INSTALLRELEASE_BIT)) {
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateCopy(&baseDir);
|
||||
ffStrbufAppendS(&path, ".config/install_release/state.json");
|
||||
if (ffPathExists(path.chars, FF_PATHTYPE_FILE)) {
|
||||
yyjson_doc* doc = yyjson_read_file(path.chars, YYJSON_READ_NOFLAG, NULL, NULL);
|
||||
if (doc != NULL) {
|
||||
yyjson_val* root = yyjson_doc_get_root(doc);
|
||||
if (yyjson_is_obj(root)) {
|
||||
result->installrelease = (uint32_t) yyjson_obj_size(root);
|
||||
}
|
||||
yyjson_doc_free(doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user