@@ -115,19 +115,6 @@ private static void analyze() throws IOException, ClassHierarchyException, CallG
115115
116116 symbolTable = symbolTableExtractionResult .getLeft ();
117117
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-
131118 if (analysisLevel > 1 ) {
132119 // Save SDG, and Call graph as JSON
133120 // 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
156143 combinedJsonObject .add ("symbol_table" , symbolTableJSON );
157144
158145 String consolidatedJSONString = gson .toJson (combinedJsonObject );
159- emit (consolidatedJSONString , "analysis.json" );
146+ emit (consolidatedJSONString );
160147 }
161148
162- private static void emit (String consolidatedJSONString , String filename ) throws IOException {
149+ private static void emit (String consolidatedJSONString ) throws IOException {
163150 if (output == null ) {
164151 System .out .println (consolidatedJSONString );
165152 } else {
153+ Path outputPath = Paths .get (output );
154+ if (!Files .exists (outputPath )) {
155+ Files .createDirectories (outputPath );
156+ }
166157 // If output is not null, export to a file
167- File file = new File (output , filename );
158+ File file = new File (output , "analysis.json" );
168159 try (FileWriter fileWriter = new FileWriter (file )) {
169160 fileWriter .write (consolidatedJSONString );
170161 Log .done ("Analysis output saved at " + output );
0 commit comments