protected override CompiledTemplate Load(string name)
{
if (Verbose)
Console.WriteLine("STGroupDir.load(" + name + ")");
string parent = Utility.GetParent(name); // must have parent; it's fully-qualified
string prefix = Utility.GetPrefix(name);
// if (parent.isEmpty()) {
// // no need to check for a group file as name has no parent
// return loadTemplateFile("/", name+TemplateFileExtension); // load t.st file
// }
if (!Path.IsPathRooted(parent))
throw new ArgumentException();
Uri groupFileURL;
try
{
// see if parent of template name is a group file
groupFileURL = new Uri(TemplateName.GetTemplatePath(root.LocalPath, parent) + GroupFileExtension);
}
catch (UriFormatException e)
{
ErrorManager.InternalError(null, "bad URL: " + TemplateName.GetTemplatePath(root.LocalPath, parent) + GroupFileExtension, e);
return null;
}
if (!File.Exists(groupFileURL.LocalPath))
{
string unqualifiedName = Path.GetFileName(name);
return LoadTemplateFile(prefix, unqualifiedName + TemplateFileExtension); // load t.st file
}
#if false
InputStream @is = null;
try
{
@is = groupFileURL.openStream();
}
catch (FileNotFoundException fnfe)
{
// must not be in a group file
return loadTemplateFile(parent, name + TemplateFileExtension); // load t.st file
}
catch (IOException ioe)
{
errMgr.internalError(null, "can't load template file " + name, ioe);
}
try
{
// clean up
if (@is != null)
@is.close();
}
catch (IOException ioe)
{
errMgr.internalError(null, "can't close template file stream " + name, ioe);
}
#endif
LoadGroupFile(prefix, groupFileURL.LocalPath);
return RawGetTemplate(name);
}