public void SaveCode(string folder)
 {
     if (!Directory.Exists(folder))
         Directory.CreateDirectory(folder);
     foreach (CompilationUnit cu in compilationUnits)
     {
         NamespaceDeclaration ns = (NamespaceDeclaration) cu.Children[0];
         TypeDeclaration type = (TypeDeclaration) ns.Children[0];
         IOutputAstVisitor vis = new JavaOutputVisitor();
         vis.VisitCompilationUnit(cu, null);
         string packageFolder = Path.Combine(folder, ns.Name);
         packageFolder = packageFolder.Replace('.', '\\');
         if (!Directory.Exists(packageFolder))
             Directory.CreateDirectory(packageFolder);
         FileSystemUtil.WriteFile(Path.Combine(packageFolder, type.Name + ".java"), vis.Text);
     }
 }
 public void SaveCode(string folder)
 {
     if (!Directory.Exists(folder))
     {
         Directory.CreateDirectory(folder);
     }
     foreach (CompilationUnit cu in compilationUnits)
     {
         NamespaceDeclaration ns   = (NamespaceDeclaration)cu.Children[0];
         TypeDeclaration      type = (TypeDeclaration)ns.Children[0];
         IOutputAstVisitor    vis  = new JavaOutputVisitor();
         vis.VisitCompilationUnit(cu, null);
         string packageFolder = Path.Combine(folder, ns.Name);
         packageFolder = packageFolder.Replace('.', '\\');
         if (!Directory.Exists(packageFolder))
         {
             Directory.CreateDirectory(packageFolder);
         }
         FileSystemUtil.WriteFile(Path.Combine(packageFolder, type.Name + ".java"), vis.Text);
     }
 }