Skip to content

Commit

Permalink
[nemo-qml-plugin-filemanager] Fix du usage with busybox. Fixes JB#49159
Browse files Browse the repository at this point in the history
No support for -b so let's just get the size in kilobytes.
Quite likely the block size is anyway multiple of those.
  • Loading branch information
pvuorela committed Mar 2, 2020
1 parent 67e8e08 commit 7f62ba6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion rpm/nemo-qml-plugin-filemanager.spec
@@ -1,6 +1,6 @@
Name: nemo-qml-plugin-filemanager
Summary: File manager plugin for Nemo Mobile
Version: 0.1.14
Version: 0.1.21
Release: 1
Group: System/Libraries
License: BSD
Expand Down
5 changes: 2 additions & 3 deletions src/plugin/diskusage_impl.cpp
Expand Up @@ -43,7 +43,6 @@

quint64 DiskUsageWorker::calculateSize(QString directory, QString *expandedPath, bool androidHomeExists)
{

// In lieu of wordexp(3) support in Qt, fake it
if (directory.startsWith("~/")) {
directory = QDir::homePath() + '/' + directory.mid(2);
Expand All @@ -68,7 +67,7 @@ quint64 DiskUsageWorker::calculateSize(QString directory, QString *expandedPath,
}

QProcess du;
du.start("du", QStringList() << "-sbx" << directory, QIODevice::ReadOnly);
du.start("du", QStringList() << "-skx" << directory, QIODevice::ReadOnly);
du.waitForFinished();
if (du.exitStatus() != QProcess::NormalExit) {
qWarning() << "Could not determine size of:" << directory;
Expand All @@ -77,7 +76,7 @@ quint64 DiskUsageWorker::calculateSize(QString directory, QString *expandedPath,
QStringList size_directory = QString::fromUtf8(du.readAll()).split('\t');

if (size_directory.size() > 1) {
return size_directory[0].toULongLong();
return size_directory[0].toULongLong() * 1024;
}

return 0L;
Expand Down

0 comments on commit 7f62ba6

Please sign in to comment.