ark: set the KArchive temporary prefix to the global working directory

fixes creating of archives with large files that cannot fit in /tmp (or
whatever the temporary directory is set to). note that this still depends
on how much space is available on the filesystem the archive is created on
and will not work for remote archives - remote archives will have to be
fetched somewhere with enough space to hold the archive and a copy of it
(possibly $HOME) but that is for another commit (currently archives are
fetched into /tmp but not uploaded upon modification)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-12-19 18:06:41 +02:00
parent 9fa6942480
commit 6eba0a9eeb

View file

@ -161,7 +161,7 @@ bool LibArchiveInterface::addFiles(const QStringList &files, const CompressionOp
{
const QString globalWorkDir = options.value(QLatin1String("GlobalWorkDir")).toString();
if (!globalWorkDir.isEmpty()) {
kDebug() << "GlobalWorkDir is set, changing dir to " << globalWorkDir;
kDebug() << "GlobalWorkDir is set, changing dir to" << globalWorkDir;
QDir::setCurrent(globalWorkDir);
}
@ -181,6 +181,12 @@ bool LibArchiveInterface::addFiles(const QStringList &files, const CompressionOp
return false;
}
if (!globalWorkDir.isEmpty()) {
const QString tempprefix(QDir::cleanPath(globalWorkDir) + QDir::separator() + QLatin1String("ark-"));
kDebug() << "GlobalWorkDir is set, setting temporary prefix to" << tempprefix;
karchive.setTempPrefix(tempprefix);
}
const QList<KArchiveEntry> oldEntries = karchive.list();
const QString strip(QDir::cleanPath(globalWorkDir) + QDir::separator());
connect(&karchive, SIGNAL(progress(qreal)), this, SLOT(emitProgress(qreal)));