mirror of
https://github.com/aristocratos/btop.git
synced 2024-05-29 08:41:19 +12:00
Fixed: Get real / mountpoint when running inside snap
This commit is contained in:
parent
ff6d1d6eec
commit
06cac6756d
|
@ -34,6 +34,7 @@ apps:
|
|||
environment:
|
||||
LC_ALL: C.UTF-8
|
||||
LANG: C.UTF-8
|
||||
BTOP_SNAPPED: true
|
||||
plugs:
|
||||
- mount-observe
|
||||
- process-control
|
||||
|
|
|
@ -679,6 +679,7 @@ namespace Mem {
|
|||
auto& swap_disk = Config::getB("swap_disk");
|
||||
auto& show_disks = Config::getB("show_disks");
|
||||
auto& mem = current_mem;
|
||||
static const bool snapped = (getenv("BTOP_SNAPPED") != NULL);
|
||||
|
||||
mem.stats.at("swap_total") = 0;
|
||||
|
||||
|
@ -803,6 +804,14 @@ namespace Mem {
|
|||
std::error_code ec;
|
||||
diskread >> dev >> mountpoint >> fstype;
|
||||
|
||||
//? If running snapped, remove internal / mountpoint and replace /mnt with / to get correct device
|
||||
if (snapped) {
|
||||
if (mountpoint == "/")
|
||||
continue;
|
||||
else if (mountpoint == "/mnt")
|
||||
mountpoint = "/";
|
||||
}
|
||||
|
||||
//? Match filter if not empty
|
||||
if (not filter.empty()) {
|
||||
bool match = v_contains(filter, mountpoint);
|
||||
|
|
Loading…
Reference in a new issue