From 27a15c6a267e7c1dd17903daa7aea4a4a101e3b3 Mon Sep 17 00:00:00 2001 From: Thomas Debesse Date: Thu, 26 Sep 2024 08:29:52 +0200 Subject: [PATCH] crnlib: don't stop listing files if there is an unknown file type in a directory, skip it Co-authored-by: DolceTriade --- crnlib/crn_find_files.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/crnlib/crn_find_files.cpp b/crnlib/crn_find_files.cpp index ce1c7707..34c5478b 100644 --- a/crnlib/crn_find_files.cpp +++ b/crnlib/crn_find_files.cpp @@ -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); @@ -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; } } }