Remove './' from begin of paths when printing progress.
This commit is contained in:
parent
dc77bc69a0
commit
342632a618
|
@ -23,6 +23,7 @@
|
|||
#include "filelister.h"
|
||||
|
||||
#include "check.h"
|
||||
#include "path.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
@ -652,7 +653,13 @@ unsigned int CppCheck::check()
|
|||
break;
|
||||
|
||||
if (_settings._errorsOnly == false)
|
||||
_errorLogger.reportOut(std::string("Checking ") + fname + std::string("..."));
|
||||
{
|
||||
std::string fixedpath(fname);
|
||||
fixedpath = Path::fromNativeSeparators(fixedpath);
|
||||
fixedpath = Path::simplifyPath(fixedpath);
|
||||
fixedpath = Path::toNativeSeparators(fixedpath);
|
||||
_errorLogger.reportOut(std::string("Checking ") + fixedpath + std::string("..."));
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -700,7 +707,13 @@ unsigned int CppCheck::check()
|
|||
|
||||
// If only errors are printed, print filename after the check
|
||||
if (_settings._errorsOnly == false && it != configurations.begin())
|
||||
_errorLogger.reportOut(std::string("Checking ") + fname + ": " + cfg + std::string("..."));
|
||||
{
|
||||
std::string fixedpath(fname);
|
||||
fixedpath = Path::fromNativeSeparators(fixedpath);
|
||||
fixedpath = Path::simplifyPath(fixedpath);
|
||||
fixedpath = Path::toNativeSeparators(fixedpath);
|
||||
_errorLogger.reportOut(std::string("Checking ") + fixedpath + ": " + cfg + std::string("..."));
|
||||
}
|
||||
|
||||
std::string appendCode = _settings.append();
|
||||
if ( !appendCode.empty() )
|
||||
|
|
|
@ -45,6 +45,11 @@ std::string Path::fromNativeSeparators(const std::string &path)
|
|||
std::string Path::simplifyPath(const std::string &path)
|
||||
{
|
||||
std::string f(path);
|
||||
|
||||
// Remove './' from begin of the path
|
||||
if (f.size() > 2 && f[0] == '.' && f[1] == '/')
|
||||
f = f.erase(0, 2);
|
||||
|
||||
// replace "/ab/../" with "/"..
|
||||
std::string::size_type pos = 0;
|
||||
while ((pos = f.find("..", pos + 1)) != std::string::npos)
|
||||
|
|
Loading…
Reference in New Issue