summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-10-20 12:05:35 +0300
committerArttu Tarkiainen <arttu.tarkiainen@qt.io>2022-10-24 09:28:39 +0300
commit57c217b5aedbb3f6a84b4b4acc887e0e46263e42 (patch)
tree776c9dc2d8b0492ff0812290d8e9f07c50999350
parentfa7a783e9b703612bbb02a9bae0f3ee125b6dd57 (diff)
Adjust available space checking for the metadata cache
As the payload archives are now also downloaded to the local cache instead of the system specific temporary directory, the calculation should check the available space from the cache volume instead of from the temp volume. Task-number: QTIFW-2821 Change-Id: I4d9f202299ea3d2569c66953661329cdb25212a0 Reviewed-by: Katja Marttila <katja.marttila@qt.io>
-rw-r--r--src/libs/installer/packagemanagercore.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/src/libs/installer/packagemanagercore.cpp b/src/libs/installer/packagemanagercore.cpp
index d5f830903..655d9cc7e 100644
--- a/src/libs/installer/packagemanagercore.cpp
+++ b/src/libs/installer/packagemanagercore.cpp
@@ -3024,10 +3024,10 @@ bool PackageManagerCore::checkAvailableSpace(QString &message) const
<< humanReadableSize(repositorySize);
if (d->m_checkAvailableSpace) {
- const VolumeInfo tempVolume = VolumeInfo::fromPath(QDir::tempPath());
+ const VolumeInfo cacheVolume = VolumeInfo::fromPath(settings().localCachePath());
const VolumeInfo targetVolume = VolumeInfo::fromPath(value(scTargetDir));
- const quint64 tempVolumeAvailableSize = tempVolume.availableSize();
+ const quint64 cacheVolumeAvailableSize = cacheVolume.availableSize();
const quint64 installVolumeAvailableSize = targetVolume.availableSize();
// at the moment there is no better way to check this
@@ -3038,20 +3038,20 @@ bool PackageManagerCore::checkAvailableSpace(QString &message) const
return true;
}
- const bool tempOnSameVolume = (targetVolume == tempVolume);
- if (tempOnSameVolume) {
- qDebug() << "Tmp and install directories are on the same volume. Volume mount point:"
+ const bool cacheOnSameVolume = (targetVolume == cacheVolume);
+ if (cacheOnSameVolume) {
+ qDebug() << "Cache and install directories are on the same volume. Volume mount point:"
<< targetVolume.mountPath() << "Free space available:"
<< humanReadableSize(installVolumeAvailableSize);
} else {
- qDebug() << "Tmp is on a different volume than the installation directory. Tmp volume mount point:"
- << tempVolume.mountPath() << "Free space available:"
- << humanReadableSize(tempVolumeAvailableSize) << "Install volume mount point:"
+ qDebug() << "Cache is on a different volume than the installation directory. Cache volume mount point:"
+ << cacheVolume.mountPath() << "Free space available:"
+ << humanReadableSize(cacheVolumeAvailableSize) << "Install volume mount point:"
<< targetVolume.mountPath() << "Free space available:"
<< humanReadableSize(installVolumeAvailableSize);
}
- if (tempOnSameVolume && (installVolumeAvailableSize <= (required + tempRequired))) {
+ if (cacheOnSameVolume && (installVolumeAvailableSize <= (required + tempRequired))) {
message = tr("Not enough disk space to store temporary files and the "
"installation. %1 are available, while the minimum required is %2.").arg(
humanReadableSize(installVolumeAvailableSize), humanReadableSize(required + tempRequired));
@@ -3065,16 +3065,11 @@ bool PackageManagerCore::checkAvailableSpace(QString &message) const
return false;
}
- if (tempVolumeAvailableSize < tempRequired) {
-#ifdef Q_OS_WIN
- static const QLatin1String scTmpVariable("\"TEMP\" or \"TMP\"");
-#elif defined(Q_OS_LINUX) || defined(Q_OS_MACOS)
- static const QLatin1String scTmpVariable("\"TMPDIR\"");
-#endif
+ if (cacheVolumeAvailableSize < tempRequired) {
message = tr("Not enough disk space to store temporary files! %1 are available, "
"while the minimum required is %2. You may select another location for the "
- "temporary files by modifying the %3 environment variable and restarting the application.")
- .arg(humanReadableSize(tempVolumeAvailableSize), humanReadableSize(tempRequired), scTmpVariable);
+ "temporary files by modifying the local cache path from the installer settings.")
+ .arg(humanReadableSize(cacheVolumeAvailableSize), humanReadableSize(tempRequired));
return false;
}