Prefix check links too

pull/28/head
jackun 4 years ago
parent 47f293a722
commit b2f20f02d2
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3

@ -57,6 +57,11 @@ std::vector<std::string> ls(const char* root, const char* prefix, LS_FLAGS flags
}
while ((dp = readdir(dirp))) {
if ((prefix && !starts_with(dp->d_name, prefix))
|| !strcmp(dp->d_name, ".")
|| !strcmp(dp->d_name, ".."))
continue;
if (dp->d_type == DT_LNK) {
struct stat s;
std::string path(root);
@ -74,10 +79,6 @@ std::vector<std::string> ls(const char* root, const char* prefix, LS_FLAGS flags
} else if (((flags & LS_DIRS) && dp->d_type == DT_DIR)
|| ((flags & LS_FILES) && dp->d_type == DT_REG)
) {
if ((prefix && !starts_with(dp->d_name, prefix))
|| !strcmp(dp->d_name, ".")
|| !strcmp(dp->d_name, ".."))
continue;
list.push_back(dp->d_name);
}
}

Loading…
Cancel
Save