Update source/src/templates.cpp
This commit is contained in:
@@ -525,12 +525,18 @@
|
||||
ASSERT(mSources.empty(), "Template manager already loaded (sources are not empty).");
|
||||
ASSERT(gConfig().is_config_set(), "Config not set.");
|
||||
ASSERT(!mLoaded, "Template manager already loaded.");
|
||||
auto local_template_paths = gConfig().get_local_template_paths();
|
||||
if (local_template_paths.empty())
|
||||
return;
|
||||
for (const auto& path : local_template_paths)
|
||||
mSources.push_back(std::make_unique<template_source_local>(path));
|
||||
|
||||
// Add local template sources only if the paths exist and are directories
|
||||
auto local_template_paths = gConfig().get_local_template_paths();
|
||||
for (const auto& path : local_template_paths) {
|
||||
if (std::filesystem::exists(path) && std::filesystem::is_directory(path)) {
|
||||
mSources.push_back(std::make_unique<template_source_local>(path));
|
||||
} else {
|
||||
info << "Skipping non-existent or invalid local template path: " << path << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
// Add registry sources - these should always be added
|
||||
auto registry_urls = gConfig().get_template_registry_urls();
|
||||
for (const auto& url : registry_urls)
|
||||
mSources.push_back(std::make_unique<template_source_registry>(url));
|
||||
|
Reference in New Issue
Block a user