diff --git a/src/corelib/FileManager.cs b/src/corelib/FileManager.cs index 90992a1d..b64b470e 100644 --- a/src/corelib/FileManager.cs +++ b/src/corelib/FileManager.cs @@ -253,10 +253,10 @@ public static List FindFiles(string SearchPath, string SrcMask, bool IsR List Result = new List(); if (Directory.Exists(SearchPath)) { - DirectoryInfo DInfo = new DirectoryInfo(SearchPath); - FileInfo[] DirList = DInfo.GetFiles(SrcMask); - foreach (FileInfo DItem in DirList) { Result.Add(DItem.FullName); } - if (IsRecursive) { foreach (DirectoryInfo Dir in DInfo.GetDirectories()) { Result.AddRange(FindFiles(Dir.FullName, SrcMask)); } } + foreach (string DItem in Directory.EnumerateFiles(SearchPath, SrcMask, IsRecursive ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly)) + { + Result.Add(DItem); + } } return Result; }