kdecore: create the last directory of the special resource if it does not exist

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-05-26 14:16:35 +03:00
parent 3ab0e01817
commit 5275fdc8a4

View file

@ -868,7 +868,10 @@ void KStandardDirs::KStandardDirsPrivate::createSpecialResource(const char *type
} else { } else {
Q_ASSERT(false); Q_ASSERT(false);
} }
q->addResourceDir(type, QDir::cleanPath(resourceDir) + QLatin1Char('/'), false); // NOTE: QStandardPaths::writableLocation() should create the base directory
const QString cleanPath = QDir::cleanPath(resourceDir) + QLatin1Char('/');
KStandardDirs::makeDir(cleanPath, 0700);
q->addResourceDir(type, cleanPath, false);
} }
QStringList KStandardDirs::resourceDirs(const char *type) const QStringList KStandardDirs::resourceDirs(const char *type) const
@ -1238,7 +1241,7 @@ QString KStandardDirs::saveLocation(const char *type,
#endif #endif
return fullPath; return fullPath;
} }
if(!makeDir(fullPath, 0700)) { if(!KStandardDirs::makeDir(fullPath, 0700)) {
return fullPath; return fullPath;
} }
d->m_dircache.remove(type); d->m_dircache.remove(type);