projects
/
wix.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
173630f
)
add support for processing directories, checking modified-times
author
adam
<adam@megacz.com>
Thu, 10 Apr 2008 16:36:20 +0000
(09:36 -0700)
committer
adam
<adam@megacz.com>
Thu, 10 Apr 2008 16:36:20 +0000
(09:36 -0700)
darcs-hash:
20080410163620
-5007d-
016a60f6befee7f2f5891c87a49c3b887aebe482
.gz
src/HaskellHelper.java
patch
|
blob
|
history
diff --git
a/src/HaskellHelper.java
b/src/HaskellHelper.java
index
daa4fe6
..
290d3d7
100644
(file)
--- a/
src/HaskellHelper.java
+++ b/
src/HaskellHelper.java
@@
-61,11
+61,16
@@
public class HaskellHelper {
}
File indir = new File(argv[0]);
File outdir = new File(argv[1]);
}
File indir = new File(argv[0]);
File outdir = new File(argv[1]);
- process(indir, "", outdir);
+ if (!indir.isDirectory()) {
+ process(new File(indir.getParent()), indir.getName(), outdir);
+ } else {
+ process(indir, "", outdir);
+ }
}
private static void process(File indir, String suffix, File outdir) throws Throwable {
}
private static void process(File indir, String suffix, File outdir) throws Throwable {
- File f = new File(indir.getAbsolutePath()+suffix);
+ File f = new File(indir.getAbsolutePath()+File.separatorChar+suffix);
+ //System.out.println(f+" "+indir + " " + suffix + " " + outdir);
if (!f.exists()) return;
if (f.isDirectory()) {
for (String s : f.list())
if (!f.exists()) return;
if (f.isDirectory()) {
for (String s : f.list())
@@
-73,15
+78,16
@@
public class HaskellHelper {
return;
}
if (f.getPath().endsWith(".wix")) {
return;
}
if (f.getPath().endsWith(".wix")) {
- System.out.println();
String out = "== " + suffix + " ";
while(out.length() < 75) out+="=";
System.out.println(ANSI.yellow(out));
String out = "== " + suffix + " ";
while(out.length() < 75) out+="=";
System.out.println(ANSI.yellow(out));
+ //System.out.println();
+ String outPath = outdir.getAbsolutePath()+File.separatorChar+suffix;
+ outPath = outPath.substring(0, outPath.length()-".wix".length())+".html";
+ if (new File(outPath).exists() && new File(outPath).lastModified() > f.lastModified()) return;
Class.forName("Main").
getMethod("main", new Class[] { String[].class }).
invoke(null, new Object[] { new String[] { f.getAbsolutePath() } });
Class.forName("Main").
getMethod("main", new Class[] { String[].class }).
invoke(null, new Object[] { new String[] { f.getAbsolutePath() } });
- String outPath = outdir.getAbsolutePath()+suffix;
- outPath = outPath.substring(0, outPath.length()-".wix".length())+".html";
new File(new File(outPath).getParent()).mkdirs();
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(outPath+"+")));
pw.println(ret);
new File(new File(outPath).getParent()).mkdirs();
PrintWriter pw = new PrintWriter(new OutputStreamWriter(new FileOutputStream(outPath+"+")));
pw.println(ret);
@@
-110,6
+116,8
@@
public class HaskellHelper {
}
}
new File(outPath+"+").renameTo(dest);
}
}
new File(outPath+"+").renameTo(dest);
+ if (dest.lastModified() <= f.lastModified())
+ dest.setLastModified(f.lastModified()+1);
}
}
}
}