]> git.lyx.org Git - lyx.git/blobdiff - src/insets/ExternalTemplate.C
Some more changes for updating text-insets.
[lyx.git] / src / insets / ExternalTemplate.C
index 34e3386d2c44b069f6e2f4cb74a3a14b2d2609f6..906cd9ad7913e025d2e230c903973f3f71ceab18 100644 (file)
 
 #include "lyxlex.h"
 #include "support/path.h"
+#include "support/LAssert.h"
 
 using std::endl;
 using std::ostream;
+using std::for_each;
 
 extern string user_lyxdir;
 
@@ -33,6 +35,7 @@ ExternalTemplate::ExternalTemplate()
        : viewCommand("true"), editCommand("true")
 {}
 
+
 ExternalTemplate::FormatTemplate::FormatTemplate()
        : updateCommand("true") {}
 
@@ -95,6 +98,7 @@ void ExternalTemplate::dumpFormats(ostream & os) const
        for_each(formats.begin(), formats.end(), dumpFormat(os));
 }
 
+
 void ExternalTemplateManager::dumpTemplates() const 
 {
        for_each(templates.begin(), templates.end(), dumpTemplate(lyxerr));
@@ -136,8 +140,14 @@ void ExternalTemplateManager::readTemplates(string const & path)
                { "templateend", TM_END }
        };
 
+       string filename = LibFileSearch("", "external_templates");
+       if (filename.empty()) {
+               lyxerr << "No template file" << endl;
+               return;
+       }
+
        LyXLex lex(templatetags, TM_END);
-       if (!lex.setFile("external_templates")) {
+       if (!lex.setFile(filename)) {
                lyxerr << "No template file" << endl;
                return;
        }