string const command = libScriptSearch(cs.str());
if (wait) {
- ForkedCall call;
+ ForkedCall call(buffer_.filePath());
int ret = call.startScript(ForkedProcess::Wait, command);
static int fake = (2^20) + 1;
int pid = fake++;
convert_ptr(new ForkedCall::SignalType);
convert_ptr->connect(bind(&Impl::finishedGenerating, this, _1, _2));
- ForkedCall call;
+ ForkedCall call(buffer_.filePath());
int ret = call.startScript(command, convert_ptr);
if (ret != 0) {
#include "support/ForkedCalls.h"
#include "support/debug.h"
+#include "support/environment.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "support/lyxlib.h"
#include "support/bind.h"
+#include "LyXRC.h"
+
#include <cerrno>
#include <queue>
#include <sstream>
//
/////////////////////////////////////////////////////////////////////
+ForkedCall::ForkedCall(string const & path)
+ : cmd_prefix_(empty_string())
+{
+ if (path.empty() || lyxrc.texinputs_prefix.empty())
+ return;
+
+ string const texinputs = os::latex_path_list(
+ replaceCurdirPath(path, lyxrc.texinputs_prefix));
+ string const sep = string(1, os::path_separator(os::TEXENGINE));
+ string const env = getEnv("TEXINPUTS");
+
+ if (os::shell() == os::UNIX)
+ cmd_prefix_ = "env 'TEXINPUTS=." + sep + texinputs
+ + sep + env + "' ";
+ else
+ cmd_prefix_ = "cmd /p /c set TEXINPUTS=." + sep + texinputs
+ + sep + env + " & ";
+}
+
int ForkedCall::startScript(Starttype wait, string const & what)
{
// generate child in background
int ForkedCall::generateChild()
{
- string line = trim(command_);
+ string const line = trim(cmd_prefix_ + command_);
if (line.empty())
return 1;
#define FORKEDCALLS_H
#include "support/shared_ptr.h"
+#include "support/strfwd.h"
#include <boost/signal.hpp>
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
-#include <string>
-
namespace lyx {
namespace support {
class ForkedCall : public ForkedProcess {
public:
+ ///
+ ForkedCall(std::string const & path = empty_string());
///
virtual shared_ptr<ForkedProcess> clone() const {
return shared_ptr<ForkedProcess>(new ForkedCall(*this));
private:
///
virtual int generateChild();
+ ///
+ std::string cmd_prefix_;
};
- Mark settings as changed when the Nomenclature line is edited in the
Tools > Preferences panel.
+- Fix instant preview when external files are loaded in the preamble,
+ e.g., through the \input LaTeX command.
+
* ADVANCED FIND AND REPLACE