kioslave: create the base thumbnail path conditionally in thumbnail slave

only when a new thumbnail is to be saved there

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2024-05-29 00:58:52 +03:00
parent b8011feac9
commit b1409732e6

View file

@ -572,8 +572,6 @@ bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& fil
const QString thumbName = hash + modTime + thumbExt; const QString thumbName = hash + modTime + thumbExt;
if (m_thumbBasePath.isEmpty()) { if (m_thumbBasePath.isEmpty()) {
m_thumbBasePath = QDir::homePath() + "/.thumbnails/"; m_thumbBasePath = QDir::homePath() + "/.thumbnails/";
KStandardDirs::makeDir(m_thumbBasePath + "normal/", 0700);
KStandardDirs::makeDir(m_thumbBasePath + "large/", 0700);
} }
QString thumbPath = m_thumbBasePath; QString thumbPath = m_thumbBasePath;
@ -599,9 +597,9 @@ bool ThumbnailProtocol::createSubThumbnail(QImage& thumbnail, const QString& fil
} else { } else {
return false; return false;
} }
if(savedCorrectly) if (savedCorrectly) {
{
Q_ASSERT(!tempFileName.isEmpty()); Q_ASSERT(!tempFileName.isEmpty());
KStandardDirs::makeDir(thumbPath, 0700);
KDE::rename(tempFileName, thumbPath + thumbName); KDE::rename(tempFileName, thumbPath + thumbName);
} }
} }