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-Debian.cpp | 2 +- libLumina/LuminaOS-DragonFly.cpp | 2 +- libLumina/LuminaOS-FreeBSD.cpp | 3 ++- libLumina/LuminaOS-Linux.cpp | 2 +- libLumina/LuminaOS-OpenBSD.cpp | 2 +- libLumina/LuminaOS-kFreeBSD.cpp | 2 +- libLumina/LuminaOS-template.cpp | 2 +- 7 files changed, 8 insertions(+), 7 deletions(-) (limited to 'libLumina') diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp index aad65ece..b0da7586 100644 --- a/libLumina/LuminaOS-Debian.cpp +++ b/libLumina/LuminaOS-Debian.cpp @@ -200,7 +200,7 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - return QString; + return QString(); } #endif diff --git a/libLumina/LuminaOS-DragonFly.cpp b/libLumina/LuminaOS-DragonFly.cpp index 2e4ae358..b9ba58a2 100644 --- a/libLumina/LuminaOS-DragonFly.cpp +++ b/libLumina/LuminaOS-DragonFly.cpp @@ -178,7 +178,7 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - 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); diff --git a/libLumina/LuminaOS-FreeBSD.cpp b/libLumina/LuminaOS-FreeBSD.cpp index dfc413b4..fc4135f0 100644 --- a/libLumina/LuminaOS-FreeBSD.cpp +++ b/libLumina/LuminaOS-FreeBSD.cpp @@ -198,10 +198,11 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - 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); return capacity; +} #endif diff --git a/libLumina/LuminaOS-Linux.cpp b/libLumina/LuminaOS-Linux.cpp index ecf0adeb..5a800cc5 100644 --- a/libLumina/LuminaOS-Linux.cpp +++ b/libLumina/LuminaOS-Linux.cpp @@ -197,7 +197,7 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - 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); 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); diff --git a/libLumina/LuminaOS-kFreeBSD.cpp b/libLumina/LuminaOS-kFreeBSD.cpp index b0c98abb..2b24ce51 100644 --- a/libLumina/LuminaOS-kFreeBSD.cpp +++ b/libLumina/LuminaOS-kFreeBSD.cpp @@ -160,7 +160,7 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - return QString; + return QString(); } #endif diff --git a/libLumina/LuminaOS-template.cpp b/libLumina/LuminaOS-template.cpp index 38e54816..dfb9d850 100644 --- a/libLumina/LuminaOS-template.cpp +++ b/libLumina/LuminaOS-template.cpp @@ -108,7 +108,7 @@ QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the inp //file system capacity QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command - return QString; + return QString(); } #endif -- cgit