Skip to content

Commit 5f3237e

Browse files
committed
Corrected recursive matching
1 parent 08f547d commit 5f3237e

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

src/filepattern/cpp/internal/filepattern.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ void FilePatternObject::matchFilesMultDir(){
100100
std::smatch sm;
101101
std::string file, file_path;
102102

103-
bool is_pushed = false;
104-
105103
// Iterate over directories and subdirectories
106104
for (const auto& entry : this->recursive_iterator_) {
107105

@@ -123,18 +121,12 @@ void FilePatternObject::matchFilesMultDir(){
123121
tup = getVariableMapMultDir(file_path, sm);
124122
}
125123

126-
if(std::get<0>(tup).size() > 0){
127-
this->valid_files_.push_back(tup);
128-
is_pushed = true;
129-
} else {
130-
is_pushed = false;
124+
// If the path vector in the tuple is not empty, it's a valid match
125+
if(!std::get<1>(tup).empty()){
126+
this->valid_files_.push_back(tup);
131127
}
132128
}
133129
}
134-
135-
if (!is_pushed && std::get<1>(tup).size() > 0) {
136-
this->valid_files_.push_back(tup);
137-
}
138130
}
139131

140132
void FilePatternObject::matchFiles() {

0 commit comments

Comments
 (0)