File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
src/Incrementalist/FileSystem Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change 1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . IO ;
4+ using System . Text ;
5+
6+ namespace Incrementalist . FileSystem
7+ {
8+ /// <summary>
9+ /// Used to look for .sln files in a given directory.
10+ /// </summary>
11+ public static class SolutionFinder
12+ {
13+ /// <summary>
14+ /// The default filter used to look for solutions in a given folder.
15+ /// </summary>
16+ public const string DefaultSolutionFilter = "*.sln" ;
17+
18+ /// <summary>
19+ /// Enumerate all of the MSBuild solution files in a given folder.
20+ /// </summary>
21+ /// <param name="folderPath">The top level path to search.</param>
22+ /// <param name="searchFilter">Optional. A wildcard filter in the form of "*.sln".</param>
23+ /// <param name="searchOption">Optional. Specifies whether to recurse sub-directories or not.</param>
24+ /// <returns>If any solutions are found, will return an enumerable list of them in order in which they are discovered.</returns>
25+ public static IEnumerable < string > GetSolutions ( string folderPath , string searchFilter = null , SearchOption ? searchOption = null )
26+ {
27+ if ( string . IsNullOrEmpty ( searchFilter ) )
28+ {
29+ return Directory . EnumerateFileSystemEntries ( folderPath , DefaultSolutionFilter , searchOption ?? SearchOption . AllDirectories ) ;
30+ }
31+
32+ return Directory . EnumerateFileSystemEntries ( folderPath , searchFilter , searchOption ?? SearchOption . AllDirectories ) ;
33+
34+ }
35+ }
36+ }
You can’t perform that action at this time.
0 commit comments