From eacbc905796f89ad90197b0328692d8c500dbcf6 Mon Sep 17 00:00:00 2001 From: william Date: Tue, 24 Mar 2015 09:22:27 +0100 Subject: create FileSystemCapacity and put it in LuminaOS --- libLumina/LuminaOS-OpenBSD.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'libLumina/LuminaOS-OpenBSD.cpp') diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp index b6996795..dc8df0a7 100644 --- a/libLumina/LuminaOS-OpenBSD.cpp +++ b/libLumina/LuminaOS-OpenBSD.cpp @@ -207,4 +207,19 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp } return info; } + +//file system capacity +QString LOS::FileSystemCapacity(QString dir) { + // on OpenBSD, df has the following layout: + //>df /home/wi + //>Filesystem 512-blocks Used Avail Capacity Mounted on + //>/dev/sd2l 14334588 739900 12877960 5% /home + + QStringList mountInfo = LUtils::getCmdOutput("df " + dir); + QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; + //we take the 5th word on the 2 line + QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); + return capacity; +} + #endif -- cgit From 58cc446a340fc9361b08372bad9c1ce9eaeaa19c Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 26 Mar 2015 15:40:44 -0400 Subject: Clean up the new filesystemusage functions a bit. Make sure that the directory is quoted within the command (could be spaces in the path). --- libLumina/LuminaOS-OpenBSD.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libLumina/LuminaOS-OpenBSD.cpp') diff --git a/libLumina/LuminaOS-OpenBSD.cpp b/libLumina/LuminaOS-OpenBSD.cpp index dc8df0a7..df6ddeba 100644 --- a/libLumina/LuminaOS-OpenBSD.cpp +++ b/libLumina/LuminaOS-OpenBSD.cpp @@ -215,7 +215,7 @@ QString LOS::FileSystemCapacity(QString dir) { //>Filesystem 512-blocks Used Avail Capacity Mounted on //>/dev/sd2l 14334588 739900 12877960 5% /home - QStringList mountInfo = LUtils::getCmdOutput("df " + dir); + QStringList mountInfo = LUtils::getCmdOutput("df \"" + dir+"\""); QString::SectionFlag skipEmpty = QString::SectionSkipEmpty; //we take the 5th word on the 2 line QString capacity = mountInfo[1].section(" ",4,4, skipEmpty); -- cgit