fix: allow loading themes with missing resources folder
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
8f2f99801e
commit
d348f20dd9
@ -165,11 +165,15 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
QString path = FS::PathCombine("themes", m_id);
|
QString path = FS::PathCombine("themes", m_id);
|
||||||
QString pathResources = FS::PathCombine("themes", m_id, "resources");
|
QString pathResources = FS::PathCombine("themes", m_id, "resources");
|
||||||
|
|
||||||
if (!FS::ensureFolderPathExists(path) || !FS::ensureFolderPathExists(pathResources)) {
|
if (!FS::ensureFolderPathExists(path)) {
|
||||||
themeWarningLog() << "couldn't create folder for theme!";
|
themeWarningLog() << "Theme directory for" << m_id << "could not be created. This theme might be invalid";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!FS::ensureFolderPathExists(pathResources)) {
|
||||||
|
themeWarningLog() << "Resources directory for" << m_id << "could not be created";
|
||||||
|
}
|
||||||
|
|
||||||
auto themeFilePath = FS::PathCombine(path, themeFile);
|
auto themeFilePath = FS::PathCombine(path, themeFile);
|
||||||
|
|
||||||
bool jsonDataIncomplete = false;
|
bool jsonDataIncomplete = false;
|
||||||
@ -230,7 +234,11 @@ CustomTheme::CustomTheme(ITheme* baseTheme, QFileInfo& fileInfo, bool isManifest
|
|||||||
|
|
||||||
QStringList CustomTheme::searchPaths()
|
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()
|
QString CustomTheme::id()
|
||||||
|
Loading…
Reference in New Issue
Block a user