Skip to content

Commit

Permalink
fixed #13641 - FileLister: do not report an error on Windows when the…
Browse files Browse the repository at this point in the history
… given path does not exist
  • Loading branch information
firewave committed Feb 19, 2025
1 parent d39f00d commit a7476af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 3 additions & 2 deletions cli/filelister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,9 @@ static std::string addFiles2(std::list<FileWithDetails>&files, const std::string
HANDLE hFind = FindFirstFileA(searchPattern.c_str(), &ffd);
if (INVALID_HANDLE_VALUE == hFind) {
const DWORD err = GetLastError();
if (err == ERROR_FILE_NOT_FOUND) {
// no files matched
if (err == ERROR_FILE_NOT_FOUND || // the pattern did not match anything
err == ERROR_PATH_NOT_FOUND) // the given search path does not exist
{
return "";
}
return "finding files failed. Search pattern: '" + searchPattern + "'. (error: " + std::to_string(err) + ")";
Expand Down
5 changes: 0 additions & 5 deletions test/testfilelister.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,7 @@ class TestFileLister : public TestFixture {
{
const std::string addfile = Path::join(Path::join(adddir, "lib2"), "token.cpp"); // does not exist
const std::string err = FileLister::addFiles(files, addfile, {}, true,PathMatch({}));
#ifdef _WIN32
// TODO: get rid of this error - caused by missing intermediate folder
ASSERT_EQUALS("finding files failed. Search pattern: '" + dirprefix_nat + "lib2\\token.cpp'. (error: 3)", err);
#else
ASSERT_EQUALS("", err);
#endif
}
{
const std::string addfile = Path::join(Path::join(adddir, "lib"), "matchcompiler.h");
Expand Down

0 comments on commit a7476af

Please sign in to comment.