Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

crnlib: don't stop listing files if there is an unknown file type in a directory, skip it #73

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions crnlib/crn_find_files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -233,18 +233,14 @@ bool find_files::find_internal(const char* pBasepath, const char* pRelpath, cons
}
}

if (!known) {
console::error("Cannot detect if the given path is a file or a directory");
return false;
}
dynamic_string filename(ep->d_name);
dynamic_string fullname = pathname + filename;

if (!is_file && !is_directory) {
console::error("The given path is not a file neither a directory");
return false;
if (!known || (!is_file && !is_directory)) {
console::warning("Ignoring unsupported path: %s", fullname.get_ptr());
continue;
}

dynamic_string filename(ep->d_name);

if (is_directory) {
if (flags & cFlagRecursive) {
paths.push_back(filename);
Expand All @@ -259,7 +255,7 @@ bool find_files::find_internal(const char* pBasepath, const char* pRelpath, cons
file.m_base = pBasepath;
file.m_rel = pRelpath;
file.m_name = filename;
file.m_fullname = pathname + filename;
file.m_fullname = fullname;
}
}
}
Expand Down