From d60804399a886f1dc26f0f22fc066ba0dd49dc16 Mon Sep 17 00:00:00 2001 From: megacz Date: Thu, 5 Feb 2009 08:19:00 -0800 Subject: [PATCH 1/1] copy any files found in the source directory which are not wix files --- src/HaskellHelper.java | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/src/HaskellHelper.java b/src/HaskellHelper.java index 753c5b8..a9efb30 100644 --- a/src/HaskellHelper.java +++ b/src/HaskellHelper.java @@ -79,7 +79,32 @@ public class HaskellHelper { process(indir, suffix + File.separatorChar + s, outdir); return; } - if (f.getPath().endsWith(".wix")) { + if (!f.getPath().endsWith(".wix")) { + boolean skip = false; + if (f.getName().equals(".DS_Store")) skip = true; + if (f.getName().endsWith("-")) skip = true; + if (!skip) { + File dest = new File(outdir.getAbsolutePath()+File.separatorChar+suffix); + if (dest.exists() && dest.lastModified()==f.lastModified() && dest.length()==f.length()) { + System.out.println(ANSI.yellow("no change: "+f.getPath())); + return; + } + System.out.println(ANSI.green("copying: "+f.getPath())); + File dest_ = new File(outdir.getAbsolutePath()+File.separatorChar+suffix+"-"); + FileOutputStream fos = new FileOutputStream(dest_); + FileInputStream fis = new FileInputStream(f); + byte[] buf = new byte[1024]; + while(true) { + int numread = fis.read(buf, 0, buf.length); + if (numread==-1) break; + fos.write(buf, 0, numread); + } + fos.close(); + fis.close(); + dest_.renameTo(dest); + dest.setLastModified(f.lastModified()); + } + } else { String out = "== " + suffix + " "; while(out.length() < 75) out+="="; System.out.println(ANSI.yellow(out)); -- 1.7.10.4