]> git.lyx.org Git - features.git/blobdiff - src/support/filetools.cpp
Manage the setting of the latex environment for Systemcall and ForkedCall
[features.git] / src / support / filetools.cpp
index 7f701407748113ec65d9a3b5075a5bfe3dd45222..828abea13f0806b828b35a62a590ebe974ee9fc9 100644 (file)
@@ -578,6 +578,26 @@ string const replaceEnvironmentPath(string const & path)
 }
 
 
+// Return a command prefix for setting the environment of the TeX engine.
+string latexEnvCmdPrefix(string const & path)
+{
+       if (path.empty() || lyxrc.texinputs_prefix.empty())
+               return string();
+
+       string const texinputs_prefix = os::latex_path_list(
+                       replaceCurdirPath(path, lyxrc.texinputs_prefix));
+       string const sep = string(1, os::path_separator(os::TEXENGINE));
+       string const texinputs = getEnv("TEXINPUTS");
+
+       if (os::shell() == os::UNIX)
+               return "env 'TEXINPUTS=." + sep + texinputs_prefix
+                                         + sep + texinputs + "' ";
+       else
+               return "cmd /d /c set TEXINPUTS=." + sep + texinputs_prefix
+                                                  + sep + texinputs + " & ";
+}
+
+
 // Replace current directory in all elements of a path list with a given path.
 string const replaceCurdirPath(string const & path, string const & pathlist)
 {