40
40
* - Otherwise, match all files where the rule matches the file's simplified absolute path.
41
41
* Globs are allowed in the rule.
42
42
* - If a rule starts with '.':
43
- * - The rule is interpreted as a path relative to `basepath`, which should be the execution directory for rules
44
- * passed to the CLI, or the directory containing the project file when imported, and then converted to an
45
- * absolute path and treated as such according to the above procedure .
43
+ * - The rule is interpreted as a path relative to `basepath` and then converted to an absolute path and
44
+ * treated as such according to the above procedure. If the rule is relative to some other directory, it should
45
+ * be modified to be relative to `basepath` first (this should be done with rules in project files, for example) .
46
46
* - Otherwise:
47
47
* - No simplification is done to the rule.
48
48
* - If the rule ends with a path separator:
@@ -83,8 +83,8 @@ class CPPCHECKLIB PathMatch {
83
83
* If a path is a directory it needs to end with a file separator.
84
84
*
85
85
* @param paths List of masks.
86
- * @param basepath Path to which matched paths are relative, when applicable. Can be relative, in which case it is
87
- * appended to Path::getCurrentPath().
86
+ * @param basepath Path to which rules and matched paths are relative, when applicable. Can be relative, in which
87
+ * case it is appended to Path::getCurrentPath().
88
88
* @param mode Case sensitivity mode.
89
89
*/
90
90
explicit PathMatch (const std::vector<std::string> &paths, const std::string &basepath = std::string(), Mode mode = Mode::platform);
@@ -97,9 +97,10 @@ class CPPCHECKLIB PathMatch {
97
97
* @param path Path to match.
98
98
* @return true if any of the masks match the path, false otherwise.
99
99
*/
100
- bool match (const std::string &path, const std::string &basepath = std::string() ) const ;
100
+ bool match (const std::string &path) const ;
101
101
102
102
private:
103
+ std::string mBasepath ;
103
104
std::regex mRegex ;
104
105
};
105
106
0 commit comments