PDA

View Full Version : setting environment for process



afflictedd2
18th March 2009, 17:17
Hi everyone,

I've been trying to append a directory to the path, but what I've tried hasn't worked so far. I've seen the example on QProcess but that is for windows, and it is to replace the whole PATH variable. I only want to append something to it.

QStringList env = QProcess::systemEnvironment();
env << "CWPROOT=" + environment;
// env << "PATH=$PATH:" + environment + "/bin";
env.replaceInStrings(QRegExp("^PATH=(.*)", Qt::CaseInsensitive), "PATH=/1:/bin:" + environment + "/bin");
syncImage.setEnvironment(env);