]> git.lyx.org Git - features.git/commitdiff
Introduce pkglist format
authorJuergen Spitzmueller <spitz@lyx.org>
Sat, 14 Jan 2023 09:45:57 +0000 (10:45 +0100)
committerJuergen Spitzmueller <spitz@lyx.org>
Sat, 14 Jan 2023 09:45:57 +0000 (10:45 +0100)
This allows us to check and reconfigure if the pkglist format is not
current

lib/chkconfig.ltx
src/LaTeXPackages.cpp

index d7c161c2ee1e69c6a218aeab57e1a511d051927f..ff95d46558f7b536df0dbb9ec34666f1ed579c33 100644 (file)
 \newwrite{\layouts} \immediate\openout \layouts = textclass.lst.tmp
 \newwrite{\vars} \immediate\openout \vars = chkconfig.vars
 \newwrite{\packages} \immediate\openout \packages = packages.lst.tmp
+% Version of the packages list
+\immediate\write\packages{!!fileformat 2}
 
 \immediate\write\layouts{%
 # This file declares layouts and their associated definition files.^^J%
index bee30558d372b3366bfc9f6fd99554b9c340ad1e..e708df1dfe2b2ac0d52dcd6a2ccd44a3d0d79a47 100644 (file)
@@ -23,6 +23,7 @@
 #include "support/FileName.h"
 #include "support/filetools.h"
 #include "support/lstrings.h"
+#include "support/Package.h"
 
 
 using namespace std;
@@ -51,6 +52,7 @@ void LaTeXPackages::getAvailable()
        packages_.clear();
 
        bool finished = false;
+       string lstformat = "1";
        // Parse config-file
        while (lex.isOK() && !finished) {
                switch (lex.lex()) {
@@ -62,10 +64,20 @@ void LaTeXPackages::getAvailable()
                        // Parse optional version info
                        lex.eatLine();
                        string const v = trim(lex.getString());
+                       if (p == "!!fileformat") {
+                               lstformat = v;
+                               continue;
+                       }
                        packages_.insert(make_pair(p, v));
                }
                }
        }
+       // Check if the pkglist has current format.
+       // Reconfigure and re-parse if not.
+       if (lstformat != "2") {
+               package().reconfigureUserLyXDir("");
+               getAvailable();
+       }
 }