@@ -31,10 +31,14 @@ public class CodeAnalysisLauncher implements ComplexityAnalysis {
31
31
private final SAXParserFactory saxParserFactory = SAXParserFactory .newInstance ();;
32
32
private String solutionDirectory = null ;
33
33
34
+ private String slnFilename = "." ;
35
+
34
36
@ Override
35
37
public void addOption (String option , String value ) {
36
38
if (option .equals ("-dir" )) {
37
39
solutionDirectory = value ;
40
+ } else if (option .equals ("sln" )) {
41
+ slnFilename = value ;
38
42
}
39
43
}
40
44
@@ -137,14 +141,25 @@ private String installCodeAnalysisAndGetPath() {
137
141
private String findSolutionFile (String directory ) {
138
142
File dir = new File (directory );
139
143
140
- File [] list = dir .listFiles ((sub , name ) -> {
141
- return name .endsWith (".sln" );
142
- });
144
+ if ("." .equals (slnFilename )) {
143
145
144
- if (list .length == 0 ) {
145
- throw new IllegalStateException ("Solution(*.sln) not found in " + directory );
146
- }
146
+ File [] list = dir .listFiles ((sub , name ) -> {
147
+ return name .endsWith (".sln" );
148
+ });
149
+
150
+ if (list .length == 0 ) {
151
+ throw new IllegalStateException ("Solution(*.sln) not found in " + directory );
152
+ }
147
153
148
- return list [0 ].getName ();
154
+ return list [0 ].getName ();
155
+ } else {
156
+ File sln = new File (dir , slnFilename );
157
+
158
+ if (sln .exists ()) {
159
+ return slnFilename ;
160
+ } else {
161
+ throw new IllegalArgumentException ("sln file not found : " + sln .getAbsolutePath ());
162
+ }
163
+ }
149
164
}
150
165
}
0 commit comments