Changeset View
Changeset View
Standalone View
Standalone View
source/ps/TemplateLoader.cpp
Show First 20 Lines • Show All 64 Lines • ▼ Show 20 Lines | if (pos != std::string::npos) | ||||
VfsPath path = VfsPath(TEMPLATE_ROOT) / L"special" / L"filter" / wstring_from_utf8(prefix + ".xml"); | VfsPath path = VfsPath(TEMPLATE_ROOT) / L"special" / L"filter" / wstring_from_utf8(prefix + ".xml"); | ||||
if (!VfsFileExists(path)) | if (!VfsFileExists(path)) | ||||
{ | { | ||||
LOGERROR("Invalid subset '%s'", prefix.c_str()); | LOGERROR("Invalid subset '%s'", prefix.c_str()); | ||||
return false; | return false; | ||||
} | } | ||||
CXeromyces xero; | CXeromyces xero; | ||||
PSRETURN ok = xero.Load(g_VFS, path); | PSRETURN ok = xero.Load(g_VFS, path, "", "simulation/templates"); | ||||
if (ok != PSRETURN_OK) | if (ok != PSRETURN_OK) | ||||
return false; // (Xeromyces already logged an error with the full filename) | return false; // (Xeromyces already logged an error with the full filename) | ||||
m_TemplateFileData[templateName] = m_TemplateFileData[baseName]; | m_TemplateFileData[templateName] = m_TemplateFileData[baseName]; | ||||
CParamNode::LoadXML(m_TemplateFileData[templateName], xero, path.string().c_str()); | CParamNode::LoadXML(m_TemplateFileData[templateName], xero, path.string().c_str()); | ||||
return true; | return true; | ||||
} | } | ||||
// Normal case: templateName is an XML file: | // Normal case: templateName is an XML file: | ||||
VfsPath path = VfsPath(TEMPLATE_ROOT) / wstring_from_utf8(templateName + ".xml"); | VfsPath path = VfsPath(TEMPLATE_ROOT) / wstring_from_utf8(templateName + ".xml"); | ||||
CXeromyces xero; | CXeromyces xero; | ||||
PSRETURN ok = xero.Load(g_VFS, path); | PSRETURN ok = xero.Load(g_VFS, path, "", "simulation/templates"); | ||||
if (ok != PSRETURN_OK) | if (ok != PSRETURN_OK) | ||||
return false; // (Xeromyces already logged an error with the full filename) | return false; // (Xeromyces already logged an error with the full filename) | ||||
int attr_parent = xero.GetAttributeID("parent"); | int attr_parent = xero.GetAttributeID("parent"); | ||||
CStr parentName = xero.GetRoot().GetAttributes().GetNamedItem(attr_parent); | CStr parentName = xero.GetRoot().GetAttributes().GetNamedItem(attr_parent); | ||||
if (!parentName.empty()) | if (!parentName.empty()) | ||||
{ | { | ||||
// To prevent needless complexity in template design, we don't allow |-separated strings as parents | // To prevent needless complexity in template design, we don't allow |-separated strings as parents | ||||
▲ Show 20 Lines • Show All 116 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator