Take cluster size into account when calculating zip extracted size.

Allow passing an (optional) cluster size to round up all file sizes when
calculating the total size of an extracted zip archive. This allows to check if
the space on disk is actually sufficient without relying on an arbitrary
headroom value which might be wrong. Addresses FS#12195.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30214 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2011-07-26 20:54:44 +00:00
parent 3bb0fed345
commit 743308e882
5 changed files with 51 additions and 10 deletions

View file

@ -140,7 +140,8 @@ void ZipInstaller::downloadDone(bool error)
// some room for operating (also includes calculation mistakes due to
// cluster sizes on the player).
if((qint64)Utils::filesystemFree(m_mountpoint)
< (zip.totalUncompressedSize() + 1000000)) {
< (zip.totalUncompressedSize(Utils::filesystemClusterSize(m_mountpoint))
+ 1000000)) {
emit logItem(tr("Not enough disk space! Aborting."), LOGERROR);
emit logProgress(1, 1);
emit done(true);