Bennett Helm wrote:

> On Feb 14, 2005, at 12:45 PM, Angus Leeming wrote:
> 
>> Angus Leeming wrote:
>>> Thanks, Bennett. What that tells me is that the problem doesn't lie in
>>> PutEnv at all. It lies in the code that calls PutEnv.
>>>
>>> I have a nasty feeling that this, or something like it, will fix the
>>> problem (still in src/support/filetools.C)
>>
>> Actually, while we're at it, let's add yet more diagnostic info:
> 
> Env var "PATH", "/usr/bin:/bin:/usr/sbin:/sbin:/Users/bennett", is
> prepended with "/Applications/LyX-136.app/Contents/MacOS/"
> setEnvPath elem: /Applications/LyX-136.app/Contents/MacOS/
> setEnvPath elem: /usr/bin
> setEnvPath elem: /bin
> setEnvPath elem: /usr/sbin
> setEnvPath elem: /sbin
> setEnvPath elem: /Users/bennett
> setEnvPath calling PutEnv(PATH=)

Well that seems pretty conclusive then. setEnvPath loops over the elements
but doesn't do anything with them.

Try changing the ss.tellp() bit to something comparing iterators: 

 void setEnvPath(string const & name, vector<string> const & env)
 {
         char const separator(os::path_separator());
         std::ostringstream ss;
-        vector<string>::const_iterator it = env.begin();
+        vector<string>::const_iterator const begin = env.begin();
         vector<string>::const_iterator const end = env.end();
+        vector<string>::const_iterator it = begin;
         for (; it != end; ++it) {
-                if (ss.tellp() > 0)
+                if (it != begin)
                         ss << separator;
                 ss << os::external_path(*it);
+                lyxerr << "setEnvPath elem: " 
+                       << os::external_path(*it) << '\n';
        }
-       PutEnv(name + "=" + ss.str());
+       string const env_str = name + "=" + string(STRCONV(ss.str()));
+       lyxerr << "setEnvPath calling PutEnv(" << env_str << ")" 
+              << std::endl;
+       PutEnv(env_str);
 }
-- 
Angus

Reply via email to