@@ -115,19 +115,6 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG
115
115
116
116
symbolTable = symbolTableExtractionResult .getLeft ();
117
117
118
- if (output != null ) {
119
- Path outputPath = Paths .get (output );
120
- if (!Files .exists (outputPath )) {
121
- Files .createDirectories (outputPath );
122
- }
123
- // Make parse error as a list/csv
124
- // String parseError = gson.toJson(symbolTableExtractionResult.getRight());
125
- // emit(parseError, "parse_errors.json");
126
- /* gson.toJson(symbolTableExtractionResult.getRight(), new FileWriter(new File(outputPath.toString(), "parse_errors.json")));
127
- * }
128
- **/
129
- }
130
-
131
118
if (analysisLevel > 1 ) {
132
119
// Save SDG, and Call graph as JSON
133
120
// If noBuild is not true, and build is also not provided, we will use "auto" as the build command
@@ -156,15 +143,19 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG
156
143
combinedJsonObject .add ("symbol_table" , symbolTableJSON );
157
144
158
145
String consolidatedJSONString = gson .toJson (combinedJsonObject );
159
- emit (consolidatedJSONString , "analysis.json" );
146
+ emit (consolidatedJSONString );
160
147
}
161
148
162
- private static void emit (String consolidatedJSONString , String filename ) throws IOException {
149
+ private static void emit (String consolidatedJSONString ) throws IOException {
163
150
if (output == null ) {
164
151
System .out .println (consolidatedJSONString );
165
152
} else {
153
+ Path outputPath = Paths .get (output );
154
+ if (!Files .exists (outputPath )) {
155
+ Files .createDirectories (outputPath );
156
+ }
166
157
// If output is not null, export to a file
167
- File file = new File (output , filename );
158
+ File file = new File (output , "analysis.json" );
168
159
try (FileWriter fileWriter = new FileWriter (file )) {
169
160
fileWriter .write (consolidatedJSONString );
170
161
Log .done ("Analysis output saved at " + output );
0 commit comments