}
-void loadTextClass(string const & name)
+void loadTextClass(string const & name, string const & buf_path)
{
pair<bool, TextClassIndex> const tc_pair =
textclasslist.numberOfClass(name);
TextClassIndex const tc = tc_pair.second;
- if (!textclasslist[tc].load()) {
+ if (!textclasslist[tc].load(buf_path)) {
docstring s = bformat(_("The document class %1$s."
"could not be loaded."),
from_utf8(textclasslist[tc].name()));
BOOST_ASSERT(lyx_view_);
Buffer * buffer = lyx_view_->buffer();
- loadTextClass(argument);
+ loadTextClass(argument, buffer->filePath());
pair<bool, TextClassIndex> const tc_pair =
textclasslist.numberOfClass(argument);
}
case LFUN_TEXTCLASS_LOAD:
- loadTextClass(argument);
+ loadTextClass(argument, lyx_view_->buffer()->filePath());
break;
case LFUN_LYXRC_APPLY: {
string const & TextClass::latexname() const
{
+ // No buffer path information is needed here because on-demand layout files
+ // have already been loaded, and no path is needed for system layouts.
const_cast<TextClass*>(this)->load();
return latexname_;
}
// fname, clname, desc, and avail
TextClass tmpl(fname, clname, desc, avail);
if (lyxerr.debugging(Debug::TCLASS)) {
+ // only system layout files are loaded here so no
+ // buffer path is needed.
tmpl.load();
}
classlist_.push_back(tmpl);
if (pp.first && classlist_[pp.second].description() == tmpl.description())
return pp;
classlist_.push_back(tmpl);
+ // This textclass is added on request so it will definitely be
+ // used. Load it now because other load() calls may fail if they
+ // are called in a context without buffer path information.
+ classlist_.back().load(path);
return make_pair(true, classlist_.size() - 1);
}
}