Author: forenr
Date: Tue Jun 14 20:06:57 2011
New Revision: 39049
URL: http://www.lyx.org/trac/changeset/39049
Log:
Don't rely on Qt for setting an environment variable.
Modified:
lyx-devel/trunk/src/support/Systemcall.cpp
lyx-devel/trunk/src/support/SystemcallPrivate.h
Modified: lyx-devel/trunk/src/support/Systemcall.cpp
==============================================================================
--- lyx-devel/trunk/src/support/Systemcall.cpp Tue Jun 14 18:32:44 2011
(r39048)
+++ lyx-devel/trunk/src/support/Systemcall.cpp Tue Jun 14 20:06:57 2011
(r39049)
@@ -268,6 +268,7 @@
out_index_(0),
err_index_(0),
out_file_(of),
+ texinputs_(getEnv("TEXINPUTS")),
process_events_(false)
{
if (!out_file_.empty()) {
@@ -290,18 +291,15 @@
cmd_ = cmd;
if (process_) {
if (!path.empty() && !lyxrc.texinputs_prefix.empty()) {
- QString const texinputs = toqstr(os::latex_path_list(
- replaceCurdirPath(path,
lyxrc.texinputs_prefix)));
- QChar const sep = os::path_separator(os::TEXENGINE);
- QString const prefix = QLatin1String("TEXINPUTS=.")
- + sep + texinputs + sep;
- QStringList env = QProcess::systemEnvironment();
- if (env.filter("TEXINPUTS=").isEmpty())
- env << prefix;
+ string const texinputs = os::latex_path_list(
+ replaceCurdirPath(path,
lyxrc.texinputs_prefix));
+ string const sep = string(1,
+ os::path_separator(os::TEXENGINE));
+ string const prefix = "." + sep + texinputs + sep;
+ if (prefixIs(texinputs_, prefix))
+ texinputs_.clear();
else
- env.replaceInStrings(QRegExp("^TEXINPUTS=(.*)"),
- prefix + "\\1");
- process_->setEnvironment(env);
+ setEnv("TEXINPUTS", prefix + texinputs_);
}
state = SystemcallPrivate::Starting;
process_->start(cmd_);
@@ -361,6 +359,9 @@
SystemcallPrivate::~SystemcallPrivate()
{
+ if (!texinputs_.empty())
+ setEnv("TEXINPUTS", texinputs_);
+
if (out_index_) {
out_data_[out_index_] = '\0';
out_index_ = 0;
Modified: lyx-devel/trunk/src/support/SystemcallPrivate.h
==============================================================================
--- lyx-devel/trunk/src/support/SystemcallPrivate.h Tue Jun 14 18:32:44
2011 (r39048)
+++ lyx-devel/trunk/src/support/SystemcallPrivate.h Tue Jun 14 20:06:57
2011 (r39049)
@@ -74,6 +74,8 @@
size_t err_index_;
///
std::string out_file_;
+ ///
+ std::string texinputs_;
/// Size of buffers.
static size_t const buffer_size_ = 200;