From c5afa7c8d54f16596eb849e4affca7d2ff28654a Mon Sep 17 00:00:00 2001 From: Ladi Prosek Date: Fri, 12 Feb 2021 13:14:01 +0100 Subject: [PATCH] Back-compat workaround --- src/Shared/FileMatcher.cs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Shared/FileMatcher.cs b/src/Shared/FileMatcher.cs index 6aed15166a4..0784baba45a 100644 --- a/src/Shared/FileMatcher.cs +++ b/src/Shared/FileMatcher.cs @@ -1063,8 +1063,24 @@ struct RecursionState { return Enumerable.Empty(); } + + // Back-compat hack: We don't use case-insensitive file enumeration I/O on Linux so the behavior is different depending + // on the NeedsToProcessEachFile flag. If the flag is false and matching is done within the _getFileSystemEntries call, + // it is case sensitive. If the flag is true and matching is handled with MatchFileRecursionStep, it is case-insensitive. + // TODO: Can we fix this by using case-insensitive file I/O on Linux? + string filespec; + if (NativeMethodsShared.IsLinux && recursionState.SearchData.DirectoryPattern != null) + { + filespec = "*.*"; + stepResult.NeedsToProcessEachFile = true; + } + else + { + filespec = recursionState.SearchData.Filespec; + } + IEnumerable files = _getFileSystemEntries(FileSystemEntity.Files, recursionState.BaseDirectory, - recursionState.SearchData.Filespec, projectDirectory, stripProjectDirectory); + filespec, projectDirectory, stripProjectDirectory); if (!stepResult.NeedsToProcessEachFile) {