]> git.lyx.org Git - lyx.git/blobdiff - src/LyX.cpp
Make layout test compile
[lyx.git] / src / LyX.cpp
index b777e55f4e45c289029333d1c4499a5bd047cb59..b7848311b85a6a10450572285cab072a7bcf0f94 100644 (file)
@@ -33,6 +33,7 @@
 #include "FuncStatus.h"
 #include "HunspellChecker.h"
 #include "KeyMap.h"
+#include "Language.h"
 #include "LaTeXFonts.h"
 #include "LayoutFile.h"
 #include "Lexer.h"
@@ -735,6 +736,18 @@ bool LyX::init()
        if (!setEnv("LyXDir", lyx_dir))
                LYXERR(Debug::INIT, "\t... failed!");
 
+       if (package().explicit_user_support() && getEnv(LYX_USERDIR_VER).empty()) {
+               // -userdir was given on the command line.
+               // Make it available to child processes, otherwise tex2lyx
+               // would not find all layout files, and other converters might
+               // use it as well.
+               string const user_dir = package().user_support().absFileName();
+               LYXERR(Debug::INIT, "Setting " LYX_USERDIR_VER "... to \""
+                                   << user_dir << '"');
+               if (!setEnv(LYX_USERDIR_VER, user_dir))
+                       LYXERR(Debug::INIT, "\t... failed!");
+       }
+
        //
        // Read configuration files
        //
@@ -832,6 +845,7 @@ bool LyX::init()
                lyxrc.print();
 
        os::windows_style_tex_paths(lyxrc.windows_style_tex_paths);
+       // Prepend path prefix a second time to take the user preferences into a account
        if (!lyxrc.path_prefix.empty())
                prependEnvPath("PATH", replaceEnvironmentPath(lyxrc.path_prefix));