rewrite Haskell parts in Scala
[wix.git] / src / HaskellHelper.java
index a9efb30..4e3b2c6 100644 (file)
@@ -91,6 +91,7 @@ public class HaskellHelper {
                 }
                 System.out.println(ANSI.green("copying: "+f.getPath()));
                 File dest_ = new File(outdir.getAbsolutePath()+File.separatorChar+suffix+"-");
+                new File(dest_.getParent()).mkdirs();
                 FileOutputStream fos = new FileOutputStream(dest_);
                 FileInputStream fis = new FileInputStream(f);
                 byte[] buf = new byte[1024];
@@ -115,6 +116,7 @@ public class HaskellHelper {
             Class.forName("Main").
                 getMethod("main", new Class[] { String[].class }).
                 invoke(null, new Object[] { new String[] { f.getAbsolutePath() } });
+                try {
             new File(new File(outPath).getParent()).mkdirs();
             PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(outPath+"+")));
             pw.println(ret);
@@ -122,7 +124,6 @@ public class HaskellHelper {
             pw.close();
             File dest = new File(outPath);
             if (dest.exists()) {
-                try {
                     Process p = Runtime.getRuntime().exec(new String[] {
                             "diff",
                             "-Bub",
@@ -138,13 +139,13 @@ public class HaskellHelper {
                         /*else System.out.println(ANSI.blue(s));*/
                     }
                     p.waitFor();
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
             }
             new File(outPath+"+").renameTo(dest);
             if (dest.lastModified() <= f.lastModified())
                 dest.setLastModified(f.lastModified()+1);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
         }
     }