]> git.lyx.org Git - lyx.git/blobdiff - src/support/debug.cpp
Remove warning
[lyx.git] / src / support / debug.cpp
index 29a167af917418a242c46100a9926cd7e41a788b..3a6f9018feb3926549c5af73e125c406b6279d7f 100644 (file)
 
 #include "support/convert.h"
 #include "support/debug.h"
+#include "support/FileName.h"
 #include "support/gettext.h"
 #include "support/lstrings.h"
-#include "support/FileName.h"
 #include "support/ProgressInterface.h"
+#include "support/regex.h"
 
 #include <iostream>
 #include <iomanip>
@@ -197,13 +198,29 @@ void LyXErr::endl()
 }
 
 
+char const * LyXErr::stripName(char const * n)
+{
+       string const name = n;
+       // find the last occurence of /src/ in name
+       static regex re("[\\/]src[\\/]");
+       string::const_iterator const begin = name.begin();
+       string::const_iterator it = begin;
+       string::const_iterator const end = name.end();
+       smatch results;
+       while (regex_search(it, end, results, re)) {
+               it = results[0].second;
+       }
+       return n + std::distance(begin, it);
+}
+
+
 // It seems not possible to instantiate operator template out of class body
 template<class T>
 LyXErr & toStream(LyXErr & l, T t)     
 {
        if (l.enabled()){
                l.stream() << t;
-                if (l.secondEnabled()) {
+               if (l.secondEnabled()) {
                        l.secondStream() << t;
                        ProgressInterface::instance()->lyxerrFlush();
                }