Fix bug when calling cppcheck without --recursive flag

This commit is contained in:
Nicolas Le Cam 2008-12-07 00:56:24 +00:00
parent 3962bb7ae0
commit d77956f63f
1 changed files with 6 additions and 2 deletions

View File

@ -156,12 +156,16 @@ void FileLister::RecursiveAddFiles( std::vector<std::string> &filenames, const s
void FileLister::RecursiveAddFiles( std::vector<std::string> &filenames, const std::string &path, bool recursive ) void FileLister::RecursiveAddFiles( std::vector<std::string> &filenames, const std::string &path, bool recursive )
{ {
std::ostringstream oss; std::ostringstream bdir, oss;
oss << path; oss << path;
if (recursive) if (recursive)
{ {
bdir << path;
if ( path.length() > 0 && path[path.length()-1] != '/' ) if ( path.length() > 0 && path[path.length()-1] != '/' )
{
bdir << "/";
oss << "/"; oss << "/";
}
oss << "*"; oss << "*";
} }
@ -174,7 +178,7 @@ void FileLister::RecursiveAddFiles( std::vector<std::string> &filenames, const s
do do
{ {
std::ostringstream fname; std::ostringstream fname;
fname << path << ffd.cFileName; fname << bdir.str().c_str() << ffd.cFileName;
if ( ffd.cFileName[0] == '.' || ffd.cFileName[0] == '\0' ) if ( ffd.cFileName[0] == '.' || ffd.cFileName[0] == '\0' )
continue; continue;