I'll have a look at this.
rh
On 07/17/2010 01:14 PM, Vincent van Ravesteijn wrote:
Richard,
Author: rgheck
Date: Wed Apr 7 18:15:26 2010
New Revision: 34080
URL: http://www.lyx.org/trac/changeset/34080
Log:
Fix bug #6611. This also gives us a more robust fall-back in case we are
completely unable to load a text class. At least not very long ago, if
we were unable even to load article, we would crash. Not now. We will
ALWAYS have at least a really basic class (nothing but Standard!)
available.
+
+LayoutFileIndex LayoutFileList::addEmptyClass(string const& textclass)
+{
+ FileName const tempLayout = FileName::tempName();
+ ofstream ofs(tempLayout.toFilesystemEncoding().c_str());
+ // This writes a very basic class, but it also attempts to include
+ // stdclass.inc. That would give us something moderately usable.
+ ofs<< "# This layout is automatically generated\n"
+ "# \\DeclareLaTeXClass{"<< textclass<< "}\n\n"
+ "Format 26\n"
Are you sure you want this hardcoded format number ? To load this
file, we now need to run layout2layout, which might not be possible
(e.g. if python is not installed). Then we crash.
+ "Input stdclass.inc\n\n"
+ << layoutpost;
ofs.close();
// We do not know if a LaTeX class is available for this
document, but setting
@@ -238,11 +244,24 @@
// tex class.
LayoutFile * tc = new LayoutFile(textclass, textclass,
"Unknown text class " + textclass, textclass + ".cls",
true);
+
if (!tc->load(tempLayout.absFilename())) {
- // The only way this happens is because the hardcoded layout
file above
- // is wrong.
- LASSERT(false, /**/);
+ // The only way this happens is because the hardcoded layout
file
+ // aboveis wrong or stdclass.inc cannot be found. So try again
typo: aboveis
+ // without stdclass.inc.
Try again without stdclass.inc ? But there still is a stdclass.inc
below ??
+ ofstream ofs2(tempLayout.toFilesystemEncoding().c_str());
+ ofs2<< "# This layout is automatically generated\n"
+ "# \\DeclareLaTeXClass{"<< textclass<< "}\n\n"
+ "Format 26\n"
Hardcoded file format ?
+ "Input stdclass.inc\n\n"
Still stdclass ?
+ << layoutpost;
+ ofs2.close();
+ if (!tc->load(tempLayout.absFilename())) {
+ // This can only happen if the hardcoded file above is
wrong.
+ LASSERT(false, /* */);
But also if lyx2lyx fails (which I encountered as I was on a PC
without Python).
Vincent