Disk (Linux): fix label detection

This commit is contained in:
李通洲
2023-08-15 20:10:01 +08:00
parent e6be90614a
commit 98b9ef74cf
3 changed files with 10 additions and 10 deletions
+3
View File
@@ -8,6 +8,9 @@ Changes:
Features:
* Add `--key-width` for aligning the left edge of values
Bugfixes:
* Fix label detection (Disk, Linux)
# 2.0.0-beta
Fastfetch v2 introduces a new configuration file format: JSON config. Please refer to <https://github.com/fastfetch-cli/fastfetch/wiki/Configuration> for details.
+4 -8
View File
@@ -122,20 +122,16 @@ static void detectName(FFDisk* disk, const FFstrbuf* device)
FF_STRBUF_AUTO_DESTROY basePath = ffStrbufCreate();
//Try partlabel first
ffStrbufSetS(&basePath, "/dev/disk/by-partlabel/");
//Try label first
ffStrbufSetS(&basePath, "/dev/disk/by-label/");
detectNameFromPath(disk, &deviceStat, &basePath);
//Try label second
if(disk->name.length == 0)
{
ffStrbufSetS(&basePath, "/dev/disk/by-label/");
//Try partlabel second
ffStrbufSetS(&basePath, "/dev/disk/by-partlabel/");
detectNameFromPath(disk, &deviceStat, &basePath);
}
//Use the mountpoint as a last resort
if(disk->name.length == 0)
ffStrbufAppend(&disk->name, &disk->mountpoint);
}
#ifdef __ANDROID__
+3 -2
View File
@@ -34,8 +34,9 @@ static void printDisk(FFDiskOptions* options, const FFDisk* disk)
}
else
{
ffParseFormatString(&key, &options->moduleArgs.key, 1, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountpoint}
ffParseFormatString(&key, &options->moduleArgs.key, 2, (FFformatarg[]){
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->mountpoint},
{FF_FORMAT_ARG_TYPE_STRBUF, &disk->name},
});
}