]> git.lyx.org Git - lyx.git/blobdiff - src/support/environment.cpp
FORMAT for format 594
[lyx.git] / src / support / environment.cpp
index 091fa278c015cfa4bc204f2d3b8d2271151a3fcc..246e6afce235269b4a25e851ef835503fa7f057d 100644 (file)
@@ -17,6 +17,7 @@
 #include "support/docstring.h"
 #include "support/lstrings.h"
 #include "support/os.h"
+#include "support/debug.h"
 
 #include <algorithm> // for remove
 #include <cstdlib>
@@ -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<string>::const_reverse_iterator token_iterator;
        token_iterator it = reversed_tokens.rbegin();
        token_iterator const end = reversed_tokens.rend();