diff --git a/src/cppcheck.cpp b/src/cppcheck.cpp index e2d4ed68b..4e33feba9 100644 --- a/src/cppcheck.cpp +++ b/src/cppcheck.cpp @@ -57,7 +57,7 @@ void CppCheck::settings(const Settings &settings) void CppCheck::addFile(const std::string &path) { - _filenames.push_back(path); + FileLister::RecursiveAddFiles(_filenames, path.c_str(), true); } void CppCheck::addFile(const std::string &path, const std::string &content) diff --git a/src/cppcheck.h b/src/cppcheck.h index 75d3fafcb..1c5cae372 100644 --- a/src/cppcheck.h +++ b/src/cppcheck.h @@ -74,7 +74,9 @@ public: * * @param path Relative or absolute path to the file to be checked, * e.g. "cppcheck.cpp". Note that only source files (.c, .cc or .cpp) - * should be added to the list. Include filese are gathered automatically. + * should be added to the list. Include files are gathered automatically. + * You can also give path, e.g. "src/" which will be scanned for source + * files recursively. */ void addFile(const std::string &path);