summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/installzip.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2008-12-13 20:09:31 +0000
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2008-12-13 20:09:31 +0000
commitbc7917daeb494de9c17d2daf779c7cd612329e35 (patch)
tree659bc54c9779050750db51e3d6b32d0b4db4475a /rbutil/rbutilqt/installzip.cpp
parentb42f379fa3f354ccc94266604bd30ac4f7ad70de (diff)
downloadrockbox-bc7917daeb494de9c17d2daf779c7cd612329e35.tar.gz
rockbox-bc7917daeb494de9c17d2daf779c7cd612329e35.tar.bz2
rockbox-bc7917daeb494de9c17d2daf779c7cd612329e35.zip
Make Rockbox Utility error out if the zip file its going to install requires more space than left on the device. Calculation adds a safety space of 1MB so you need at least 1MB more free space than the extracted archive. This also catches differences due to the size calculation not taking cluster losses into account. Free disk space is also displayed in the sysinfo dialog. Fixes FS#9417.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19428 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/rbutilqt/installzip.cpp')
-rw-r--r--rbutil/rbutilqt/installzip.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/rbutil/rbutilqt/installzip.cpp b/rbutil/rbutilqt/installzip.cpp
index 5842e00d3f..9539e3a640 100644
--- a/rbutil/rbutilqt/installzip.cpp
+++ b/rbutil/rbutilqt/installzip.cpp
@@ -19,7 +19,7 @@
#include "installzip.h"
#include "rbunzip.h"
-
+#include "utils.h"
ZipInstaller::ZipInstaller(QObject* parent): QObject(parent)
{
@@ -148,6 +148,17 @@ void ZipInstaller::downloadDone(bool error)
return;
}
+ // check for free space. Make sure after installation will still be
+ // some room for operating (also includes calculation mistakes due to
+ // cluster sizes on the player).
+ if(filesystemFree(m_mountpoint) < (uz.totalSize() + 1000000)) {
+ m_dp->addItem(tr("Not enough disk space! Aborting."), LOGERROR);
+ m_dp->abort();
+ m_dp->setProgressMax(1);
+ m_dp->setProgressValue(1);
+ emit done(true);
+ return;
+ }
ec = uz.extractArchive(m_mountpoint);
// TODO: better handling of aborted unzip operation.
if(ec != UnZip::Ok) {