From 1631f74700de7f1c24d94299f9d4ce4fa46fc1d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Sat, 11 Oct 2025 18:20:56 +0800 Subject: [PATCH] Disk (Linux): revisits 78c6d7104999fe79222513c30adae249668360f1 --- CHANGELOG.md | 2 ++ doc/json_schema.json | 4 ++-- src/modules/disk/disk.c | 9 +++------ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 72ec51bdc..33d59456f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ Features: * Adds basic support for Wine (Windows) * Adds basic support for hppa and sh architectures (CPU, Linux) * Improves T-Head SoC name detection from the device tree (#1997, CPU, Linux) +* `Disk.hideFolders` now supports glob patterns (Disk) + * For example, `/boot/*` will match both `/boot/efi` and `/boot/firmware` Bugfixes: * Avoids integer overflow when calculating swap size (#1988, Swap, Windows) diff --git a/doc/json_schema.json b/doc/json_schema.json index d32269bd2..e39d4cf42 100644 --- a/doc/json_schema.json +++ b/doc/json_schema.json @@ -2326,7 +2326,7 @@ ] }, "hideFolders": { - "description": "A list of folder paths to hide from the disk output", + "description": "A list of folder paths (or glob patterns) to hide from the disk output", "oneOf": [ { "type": "string", @@ -2342,7 +2342,7 @@ "uniqueItems": true } ], - "default": "/efi:/boot:/boot/efi:/boot/firmware" + "default": "/efi:/boot:/boot/*" }, "hideFS": { "description": "A list of file systems to hide from the disk output", diff --git a/src/modules/disk/disk.c b/src/modules/disk/disk.c index c9995db4f..3369287c2 100644 --- a/src/modules/disk/disk.c +++ b/src/modules/disk/disk.c @@ -230,11 +230,8 @@ bool ffPrintDisk(FFDiskOptions* options) if(__builtin_expect(options->folders.length == 0, 1) && (disk->type & ~options->showTypes)) continue; - if (options->hideFolders.length) - { - if (isMatchFolders(&options->hideFolders, &disk->mountpoint, FF_DISK_FOLDER_SEPARATOR)) - continue; - } + if (options->hideFolders.length && isMatchFolders(&options->hideFolders, &disk->mountpoint, FF_DISK_FOLDER_SEPARATOR)) + continue; if (options->hideFS.length && ffStrbufSeparatedContain(&options->hideFS, &disk->filesystem, ':')) continue; @@ -482,7 +479,7 @@ void ffInitDiskOptions(FFDiskOptions* options) #if _WIN32 || __APPLE__ || __ANDROID__ ffStrbufInit(&options->hideFolders); #else - ffStrbufInitS(&options->hideFolders, "/efi:/boot:/boot/efi:/boot/firmware"); + ffStrbufInitS(&options->hideFolders, "/efi:/boot:/boot/*"); #endif ffStrbufInit(&options->hideFS); options->showTypes = FF_DISK_VOLUME_TYPE_REGULAR_BIT | FF_DISK_VOLUME_TYPE_EXTERNAL_BIT | FF_DISK_VOLUME_TYPE_READONLY_BIT;