mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-10-29 08:13:44 +01:00
Disk (Linux): be more careful to detect external type
This commit is contained in:
@@ -210,10 +210,11 @@ static bool isRemovable(FFDisk* currentDisk)
|
||||
|
||||
if (!ffStrStartsWith(partitionName, entry->d_name)) continue;
|
||||
|
||||
// /sys/block/sdx/device/delete
|
||||
// /sys/block/sdx/removable
|
||||
ffStrbufAppendS(&basePath, entry->d_name);
|
||||
ffStrbufAppendS(&basePath, "/device/delete");
|
||||
return ffPathExists(basePath.chars, FF_PATHTYPE_FILE);
|
||||
ffStrbufAppendS(&basePath, "/removable");
|
||||
char removableChar = '0';
|
||||
return ffReadFileData(basePath.chars, 1, &removableChar) > 0 && removableChar == '1';
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user