try {
FileObject root = proj.getProjectDirectory();
final String path = root.getPath();
File f = new File(path + "/assets");
AssetFolder assetFolder = AssetsBuilder.getInstance().build(f);
// JCodeModel jcm = new JCodeModel();
// try {
// JDefinedClass mainClass = jcm._class(JMod.PUBLIC | JMod.FINAL, "generated.Assets", ClassType.CLASS);
//
// buildClass(assetFolder, mainClass);
// } catch (JClassAlreadyExistsException ex) {
// Exceptions.printStackTrace(ex);
// }
// try {
// jcm.build(new CodeWriter() {
//
// private FileOutputStream fout;
//
// @Override
// public void close() throws IOException {
// fout.close();
// System.out.println("Closing");
// }
//
// @Override
// public OutputStream openBinary(JPackage jp, String string) throws IOException {
// File f = new File(path + "/src");
// System.out.println(f.getPath());
// File gen = new File(f, "generated");
// f.mkdirs();
// gen.mkdirs();
// File assetClass = new File(gen, string);
//
// assetClass.createNewFile();
// fout = new FileOutputStream(assetClass);
// System.out.println(assetClass.getAbsolutePath());
// return fout;
// }
// });
// } catch (IOException ex) {
// Exceptions.printStackTrace(ex);
// }
File file = new File(path + "/src");
System.out.println(f.getPath());
File gen = new File(file, "generated");
file.mkdirs();
gen.mkdirs();
File assetClass = new File(gen, "assets.java");
assetClass.createNewFile();
String theStuff = "package generated;\n\n"+assetFolder.toString();
PrintWriter bw = new PrintWriter(new FileWriter(assetClass, false));
bw.println(theStuff);
bw.flush();
bw.close();