X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2Fsupport%2Fenvironment.cpp;h=246e6afce235269b4a25e851ef835503fa7f057d;hb=c6b17b7094c42ff6bf96e3452f69023c724d15b7;hp=091fa278c015cfa4bc204f2d3b8d2271151a3fcc;hpb=68a1f9a44ea36691ada208d4c7d3d49ffab32f3b;p=lyx.git diff --git a/src/support/environment.cpp b/src/support/environment.cpp index 091fa278c0..246e6afce2 100644 --- a/src/support/environment.cpp +++ b/src/support/environment.cpp @@ -17,6 +17,7 @@ #include "support/docstring.h" #include "support/lstrings.h" #include "support/os.h" +#include "support/debug.h" #include // for remove #include @@ -57,7 +58,13 @@ bool setEnv(string const & name, string const & value) // CHECK Look at and fix this. // f.ex. what about error checking? - string const encoded = to_local8bit(from_utf8(value)); + string encoded; + try { + encoded = to_local8bit(from_utf8(value)); + } catch (...) { + return false; + } + #if defined (HAVE_SETENV) return ::setenv(name.c_str(), encoded.c_str(), 1) == 0; #elif defined (HAVE_PUTENV) @@ -101,6 +108,7 @@ void prependEnvPath(string const & name, string const & prefix) // Prepend each new element to the list, removing identical elements // that occur later in the list. + LYXERR(Debug::INIT, "Prepending \"" << prefix << "\" to PATH"); typedef vector::const_reverse_iterator token_iterator; token_iterator it = reversed_tokens.rbegin(); token_iterator const end = reversed_tokens.rend();