]> git.lyx.org Git - features.git/blobdiff - src/tex2lyx/tex2lyx.cpp
tex2lyx: Run configure.py if needed (bug #8539)
[features.git] / src / tex2lyx / tex2lyx.cpp
index e4c26603b1798e1ee0031754ba15e0b67870ccac..8f9d6ae7887609b8825436d5f6a3886a41bc89ad 100644 (file)
@@ -996,6 +996,20 @@ int main(int argc, char * argv[])
                        return EXIT_FAILURE;
        }
 
+       // Check that user LyX directory is ok.
+       FileName const sup = package().user_support();
+       if (sup.exists() && sup.isDirectory()) {
+               string const lock_file = package().getConfigureLockName();
+               int fd = fileLock(lock_file.c_str());
+               if (configFileNeedsUpdate("lyxrc.defaults") ||
+                   configFileNeedsUpdate("lyxmodules.lst") ||
+                   configFileNeedsUpdate("textclass.lst") ||
+                   configFileNeedsUpdate("packages.lst"))
+                       package().reconfigureUserLyXDir("");
+               fileUnlock(fd, lock_file.c_str());
+       } else
+               error_message("User directory does not exist.");
+
        // Now every known option is parsed. Look for input and output
        // file name (the latter is optional).
        string infilename = internal_path(os::utf8_argv(1));