2 * \file LaTeXPackages.cpp
3 * This file is part of LyX, the document processor.
4 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * \author André Pönitz
12 * Full author contact details are available in file CREDITS.
17 #include "LaTeXPackages.h"
21 #include "support/FileName.h"
22 #include "support/filetools.h"
23 #include "support/lstrings.h"
27 using namespace lyx::support;
32 LaTeXPackages::Packages LaTeXPackages::packages_;
35 void LaTeXPackages::getAvailable()
38 support::FileName const real_file = libFileSearch("", "packages.lst");
40 if (real_file.empty())
43 lex.setFile(real_file);
48 // Make sure that we are clean
51 bool finished = false;
53 while (lex.isOK() && !finished) {
59 packages_.insert(lex.getString());
65 bool LaTeXPackages::isAvailable(string const & name)
67 if (packages_.empty())
70 if (suffixIs(n, ".sty"))
71 n.erase(name.length() - 4);
72 return packages_.find(n) != packages_.end();