fix: allow loading themes with missing resources folder

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2023-10-17 10:00:17 +02:00
parent 8f2f99801e
commit d348f20dd9
No known key found for this signature in database
GPG Key ID: E13DFD4B47127951

View File

@ -165,11 +165,15 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
QString path = FS::PathCombine("themes", m_id);
QString pathResources = FS::PathCombine("themes", m_id, "resources");
if (!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) {
themeWarningLog() << "couldn't create folder for theme!";
if (!FS::ensureFolderPathExists(path)) {
themeWarningLog() << "Theme directory for" << m_id << "could not be created. This theme might be invalid";
return;
}
if (!FS::ensureFolderPathExists(pathResources)) {
themeWarningLog() << "Resources directory for" << m_id << "could not be created";
}
auto themeFilePath = FS::PathCombine(path, themeFile);
bool jsonDataIncomplete = false;
@ -230,7 +234,11 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
QStringList CustomTheme::searchPaths()
{
return { FS::PathCombine("themes", m_id, "resources") };
QString pathResources = FS::PathCombine("themes", m_id, "resources");
if (QFileInfo::exists(pathResources))
return { pathResources };
return {};
}
QString CustomTheme::id()