aboutsummaryrefslogtreecommitdiff
path: root/libLumina/LuminaOS-Debian.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libLumina/LuminaOS-Debian.cpp')
-rw-r--r--libLumina/LuminaOS-Debian.cpp17
1 files changed, 15 insertions, 2 deletions
diff --git a/libLumina/LuminaOS-Debian.cpp b/libLumina/LuminaOS-Debian.cpp
index aad65ece..f1048347 100644
--- a/libLumina/LuminaOS-Debian.cpp
+++ b/libLumina/LuminaOS-Debian.cpp
@@ -195,12 +195,25 @@ int LOS::batterySecondsLeft(){ //Returns: estimated number of seconds remaining
//File Checksums
QStringList LOS::Checksums(QStringList filepaths){ //Return: checksum of the input file
- return QStringList();
+ QStringList info = LUtils::getCmdOutput("md5sum \""+filepaths.join("\" \"")+"\"");
+ for(int i=0; i<info.length(); i++){
+ // first: md5sum: = error ; second: there's always one empty entry generated by getCmdOutput
+ if( info[i].startsWith("md5sum:") || info[i].isEmpty()){ info.removeAt(i); i--; }
+ else{
+ //Strip out the extra information
+ info[i] = info[i].section(" ",0,0);
+ }
+ }
+ return info;
}
//file system capacity
QString LOS::FileSystemCapacity(QString dir) { //Return: percentage capacity as give by the df command
- return QString;
+ QStringList mountInfo = LUtils::getCmdOutput("df -h " + dir);
+ QString::SectionFlag skipEmpty = QString::SectionSkipEmpty;
+ //output: 200G of 400G available on /mount/point
+ QString capacity = mountInfo[1].section(" ",3,3, skipEmpty) + " of " + mountInfo[1].section(" ",1,1, skipEmpty) + " available on " + mountInfo[1].section(" ",5,5, skipEmpty);
+ return capacity;
}
#endif
bgstack15